SDE-Preparation

Day 1 (ARRAYS)

1. https://www.geeksforgeeks.org/sort-binary-array-using-one-traversal/
Given a binary array, sort it using one traversal and no extra space.
2. https://leetcode.com/problems/container-with-most-water/
Given n non-negative integers a_1, a_2, ..., a_n where each represents a point at coordinate (i, a_i) . ‘ n ‘ vertical lines are drawn such that the two endpoints of line i is at (i, a_i) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water.
3. https://www.geeksforgeeks.org/equilibrium-index-of-an-array/
Equilibrium index of an array is an index such that the sum of elements at lower indexes is equal to the sum of elements at higher indexes.
4. https://www.geeksforgeeks.org/find-duplicates-in-on-time-and-constant-extra-space/
Given an array of n elements which contains elements from 0 to n-1, with any of these numbers appearing any number of times. Find these repeating numbers in O(n) and using only constant memory space.
5. https://www.geeksforgeeks.org/count-frequencies-elements-array-o1-extra-space-time/
Given an unsorted array of n integers which can contain integers from 1 to n. Some elements can be repeated multiple times and some other elements can be absent from the array. Count frequency of all elements that are present and print the missing elements.
6. https://leetcode.com/problems/intersection-of-two-arrays/
Given two arrays, write a function to compute their intersection. Each element in the result must be unique. The result can be in any order.
7. https://leetcode.com/problems/maximum-subarray/
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
8. https://www.geeksforgeeks.org/find-second-largest-element-array/
Given an array of integers, our task is to write a program that efficiently finds the second largest element present in the array.
9. https://leetcode.com/problems/maximum-sum-circular-subarray/
Given n numbers (both +ve and -ve), arranged in a circle, fnd the maximum sum of consecutive number.
10. https://practice.geeksforgeeks.org/problems/max-sum-in-the-configuration/1
Given an array(0-based indexing), you have to find the max sum of i*A[i] where A[i] is the element at index i in the array. The only operation allowed is to rotate(clock-wise or counter clock-wise) the array any number of times. ----------------------------------------------------------------------------------------------------------------

Day 2 (ARRAYS)

11. https://www.geeksforgeeks.org/maximum-sum-path-across-two-arrays/
Given two sorted arrays, such that the arrays may have some common elements. Find the sum of the maximum sum path to reach from the beginning of any array to end of any of the two arrays. We can switch from one array to another array only at common elements. Note: The common elements do not have to be at the same indexes.
12. https://www.geeksforgeeks.org/given-an-array-arr-find-the-maximum-j-i-such-that-arrj-arri/
Given an array arr[], find the maximum j – i such that arr[j] > arr[i].
13. https://www.geeksforgeeks.org/find-the-minimum-distance-between-two-numbers/
Given an unsorted array arr[] and two numbers x and y, find the minimum distance between x and y in arr[]. T he array might also contain duplicates. You may assume that both x and y are different and present in arr[].
14. https://www.geeksforgeeks.org/find-whether-subarray-form-mountain-not/
We are given an array of integers and a range, we need to find whether the subarray which falls in this range has values in the form of a mountain or not. All values of the subarray are said to be in the form of a mountain if either all values are increasing or decreasing or first increasing and then decreasing.
15. https://www.geeksforgeeks.org/merging-intervals/
Given a collection of Intervals,merge all the overlapping Intervals. For example:
Given [1,3], [2,6], [8,10], [15,18],
return [1,6], [8,10], [15,18].
Make sure the returned intervals are sorted.
16. https://www.geeksforgeeks.org/a-product-array-puzzle/
Given an array arr[] of n integers, construct a Product Array prod[] (of same size) such that prod[i] is equal to the product of all the elements of arr[] except arr[i]. Solve it without division operator in O(n) time.
17. https://www.geeksforgeeks.org/rearrange-given-array-place/
Given an array arr[] of size n where every element is in range from 0 to n-1. Rearrange the given array so that arr[i] becomes arr[arr[i]]. This should be done with O(1) extra space.
18. https://www.geeksforgeeks.org/remove-duplicates-from-an-array-of-small-primes/
Given an array of primes such that the range of primes is small. Remove duplicates from the array.
19. https://www.geeksforgeeks.org/replace-0-5-input-integer/
Given an integer as input and replace all the ‘0’ with ‘5’ in the integer.
20. https://www.geeksforgeeks.org/array-rotation/
Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements.

Day 3 (ARRAYS)

21. https://www.geeksforgeeks.org/find-a-sorted-subsequence-of-size-3-in-linear-time/ 22. https://www.geeksforgeeks.org/maximum-sum-such-that-no-two-elements-are-adjacent/ 23. https://www.geeksforgeeks.org/find-subarray-with-given-sum/ 24. https://www.geeksforgeeks.org/third-largest-element-array-distinct-elements/ 25. https://www.geeksforgeeks.org/find-a-triplet-that-sum-to-a-given-value/ 26. https://www.geeksforgeeks.org/trapping-rain-water/ 27. https://www.geeksforgeeks.org/union-and-intersection-of-two-sorted-arrays-2/ 28. https://www.geeksforgeeks.org/sort-array-wave-form-2/ 29. https://www.geeksforgeeks.org/sort-an-array-of-0s-1s-and-2s/ 30. https://www.geeksforgeeks.org/find-a-repeating-and-a-missing-number/