As you guys gear up for your preparation, we thought of giving you the list of important questions from various topics. These are the questions that were asked in the online round or interviews, collected from some of my friends.
First, we are starting off with Arrays.
Array Rotation
- Check if it is possible to sort the array after rotating it.
- Rotate a matrix by 90 degrees in the clockwise direction without using extra space.
- Sort rotated sorted array.
- Print left rotation array.
- Given a sorted and rotated array find if there is a pair with a given sum.
- Rotate bits of an integer.
- Search an element in a sorted and pivoted array.
Array Rearrangement
- Rearrange array such that arr[i] = i.
- Rearrange array such that arr[i] >= arr[j] if i is even and arr[i]<=arr[j] if i is odd and j < i.
- Rearrange Positive and Negative numbers in O(n) time and O(1) extra space.
- Move all zeroes to end of array (Using single traversal).
- Rearrange an array in maximum-minimum form | Set 2 (O(1) extra space).
- Positive elements at even and negative at odd positions (Relative order not maintained).
- Replace every array element by multiplication of previous and next.
- Segregate 0s and 1s in an array.
- Largest subarray with equal number of 0s and 1s.
- Maximum Product Subarray.
- Find Index of 0 to be replaced with 1 to get longest continuous sequence of 1s in a binary array.
- Convert array into Zig-Zag fashion
Order Statistics:-
- k largest(or smallest) elements in an array | added Min Heap method
- K’th Smallest/Largest Element in Unsorted Array
- Kth smallest element in a row-wise and column-wise sorted 2D array
- Median of Stream of Running Integers using STL
- Find Second largest element in an array
- Find the smallest missing number
- Given an array arr[], find the maximum j – i such that arr[j] > arr[i]
- Longest Increasing Subsequence Size (N log N)
- Find the maximum repeating number in O(n) time and O(1) extra space
- Find the smallest positive number missing from an unsorted array
- Given an array of size n and a number k, find all elements that appear more than n/k times
- Find the closest pair from two sorted arrays
- Find zeroes to be flipped so that number of consecutive 1’s is maximized
- Next Greater Element
Optimization problem
- Maximum profit by buying and selling a share at most twice
- Largest Sum Contiguous Subarray
- Minimum number of jumps to reach end
- Smallest subarray with sum greater than a given value
- Size of The Subarray With Maximum Sum
Sorting
- Sort an array in wave form
- Merge an array of size n into another array of size m+n
- Two elements whose sum is closest to zero
- Minimum number of swaps required to sort an array
- Sort an array of 0s, 1s and 2s
- Find the Minimum length Unsorted Subarray, sorting which makes the complete array sorted
- Median in a stream of integers (running integers)
- Find number of pairs (x, y) in an array such that x^y > y^x
- Merge two sorted arrays with O(1) extra space
- Check if reversing a sub array make the array sorted
Searching
- Find element in a sorted array whose frequency is greater than or equal to n/2.
- Count frequencies of all elements in array in O(1) extra space and O(n) time
- Count pairs with given sum
- Trapping Rain Water
- Median of two sorted arrays with different sizes in O(log(min(n, m)))
- Non-Repeating Element
- Most frequent element in an array
- Number of pairs with maximum sum
- Check whether Arithmetic Progression can be formed from the given array
- Given a sorted array and a number x, find the pair in array whose sum is closest to x
- Count 1’s in a sorted binary array
- Find the first repeating element in an array of integers
- Find the repeating and the missing.
- Find four elements that sum to a given value
- Maximum triplet sum in array
- Smallest Difference Triplet from Three arrays
- Find a triplet that sum to a given value
- Count triplets with sum smaller than a given value
- Find a triplet such that sum of two equals to third element
- Find the Missing Number
- Given an array A[] and a number x, check for pair in A[] with sum as x
- Find common elements in three sorted arrays
- Find position of an element in a sorted array of infinite numbers
- Find the element that appears once in an array where every other element appears twice
- Find the only repetitive element between 1 to n-1
- Find subarray with given sum
- Two Pointers Technique
- Majority Element
- Equilibrium index of an array
Comments
Post a Comment