Commonly Asked Interview Questions (Arrays)


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

  1. k largest(or smallest) elements in an array | added Min Heap method
  2. K’th Smallest/Largest Element in Unsorted Array
  3. Kth smallest element in a row-wise and column-wise sorted 2D array
  4. Median of Stream of Running Integers using STL
  5. Find Second largest element in an array
  6. Find the smallest missing number
  7. Given an array arr[], find the maximum j – i such that arr[j] > arr[i]
  8. Longest Increasing Subsequence Size (N log N)
  9. Find the maximum repeating number in O(n) time and O(1) extra space
  10. Find the smallest positive number missing from an unsorted array
  11. Given an array of size n and a number k, find all elements that appear more than n/k times
  12. Find the closest pair from two sorted arrays
  13. Find zeroes to be flipped so that number of consecutive 1’s is maximized
  14. Next Greater Element

Optimization problem

  1. Find element in a sorted array whose frequency is greater than or equal to n/2.
  2. Count frequencies of all elements in array in O(1) extra space and O(n) time
  3. Count pairs with given sum
  4. Trapping Rain Water
  5. Median of two sorted arrays with different sizes in O(log(min(n, m)))
  6. Non-Repeating Element
  7. Most frequent element in an array
  8. Number of pairs with maximum sum
  9. Check whether Arithmetic Progression can be formed from the given array
  10. Given a sorted array and a number x, find the pair in array whose sum is closest to x
  11. Count 1’s in a sorted binary array
  12. Find the first repeating element in an array of integers
  13. Find the repeating and the missing.
  14. Find four elements that sum to a given value
  15. Maximum triplet sum in array
  16. Smallest Difference Triplet from Three arrays
  17. Find a triplet that sum to a given value
  18. Count triplets with sum smaller than a given value
  19. Find a triplet such that sum of two equals to third element
  20. Find the Missing Number
  21. Given an array A[] and a number x, check for pair in A[] with sum as x
  22. Find common elements in three sorted arrays
  23. Find position of an element in a sorted array of infinite numbers
  24. Find the element that appears once in an array where every other element appears twice
  25. Find the only repetitive element between 1 to n-1
  26. Find subarray with given sum
  27. Two Pointers Technique
  28. Majority Element
  29. Equilibrium index of an array
We will be posting important questions of other topics soon!!. Till then keep sharing and supporting us.


Comments