ProDeveloperTutorialonAugust 7, 2026 Arrays: Given a string, reverse the string. Example 1: Input: "hello" Output: "olleh" Example 2: Input: “ProDeveloperTutorial is a good website” Output: etisbew doog…
ProDeveloperTutorialonAugust 7, 2026 Arrays: Given an array that is sorted and a target, if the target is found, return the index. If not found, return the index where it would be if it were inserted Example 1: Input: [1,2,3,6], 6 Output: 3 Example 2: Input: [1,2,3,6], 5 Output: 3 Method 1: By using “lower_bound” STL function. By using…
ProDeveloperTutorialonAugust 7, 2026 Arrays: Given a sorted array, find the starting and ending index that matches the target Given a sorted array and an element “k”. Get the start index and the end index of the given “k” value. Example 1: Array: [1, 2, 3, 4, 4, 4, 5,…
ProDeveloperTutorialonAugust 7, 2026 Arrays: Given an array, and value K find the k th distinct element among unique elements in an array Problem Statement: You are given an array and a value “k”. The array may have duplicates and the output should print the k-th…
ProDeveloperTutorialonAugust 7, 2026 Arrays: Given an array, check if it has any duplicate elements, 2 solutions Your program should return true if the array has duplicates, else return false if all the array elements are unique. Example: Input: [1, 2, 3,…
ProDeveloperTutorialonAugust 7, 2026 Arrays: Given a string, reverse all the vowels in the string Example 1: Input: hello Output: holle Example 2: Input: prodevelopertutorial Output: pradivolupertotereol We can solve this problem in 2…
ProDeveloperTutorialonAugust 7, 2026 Arrays: Get minimum number of moves to sort an array Problem Statement: You are given an array and elements are in the range of 1 to n. You need to count the number of move to front operations to…
ProDeveloperTutorialonAugust 6, 2026 Arrays: Given an array, move all the negative number to the end by preserving the relative order. Problem Statement: You are given an array, you need to find the prefix sum of the array. Prefix sum array is a new array of same size of…
ProDeveloperTutorialonAugust 6, 2026 Arrays: Given an array, find the minimum operations to make binary array to one Problem Statement: You are given a binary array, you need to choose any 3 consecutive elements and you need to flip al the 3 elements. By…
ProDeveloperTutorialonAugust 6, 2026 Arrays: Given an array, find minimum number of swaps required to sort the array Problem Statement: You are given an array. You need to find the minimum number of swaps required to sort the array. Example: Input: arr[] = {…