Huge collection of Array Interview Questions

 
An array is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. The simplest type of data structure is a linear array, also called one-dimensional array.

Arrays are among the oldest and most important data structures, and are used by almost every program. They are also used to implement many other data structures, such as lists, heaps, hash tables, deques, queues, stacks, strings.

 
Below is the list of commonly asked interview questions that uses array data structure –
 

  1. Find pair with given sum in the array
     
  2. Check if subarray with 0 sum is exists or not
     
  3. Find sub-array with 0 sum
     
  4. Sort binary array in linear time
     
  5. Find a duplicate element in a limited range array
     
  6. Find largest sub-array formed by consecutive integers
     
  7. Find maximum length sub-array having given sum
     
  8. Find maximum length sub-array having equal number of 0’s and 1’s
     
  9. Sort an array containing 0’s, 1’s and 2’s(Dutch national flag problem)
     
  10. Inplace merge two sorted arrays
     
  11. Merge two arrays by satisfying given constraints
     
  12. Find index of 0 to replaced to get maximum length sequence of continuous ones
     
  13. Find maximum product of two integers in an array
     
  14. Shuffle a given array of elements (Fisher–Yates shuffle)
     
  15. Rearrange the array with alternate high and low elements
     
  16. Find equilibrium index of an array
     
  17. Find majority element in an array (Boyer–Moore majority vote algorithm)
     
  18. Move all zeros present in the array to the end
     
  19. Replace each element of array with product of every other element without using / operator
     
  20. Find Longest Bitonic Subarray in an array
     
  21. Find maximum difference between two elements in the array by satisfying given constraints
     
  22. Maximum subarray problem (Kadane’s algorithm)
     
  23. Print continuous subarray with maximum sum
     
  24. Maximum Sum Circular Subarray
     
  25. Find all distinct combinations of given length
     
  26. Find all distinct combinations of given length with repetition allowed
     
  27. Find maximum sequence of continuous 1’s formed by replacing at-most k zeroes by ones
     
  28. Find minimum sum subarray of given size k
     
  29. Find subarray having given sum in given array of integers
     
  30. Find the length of smallest subarray whose sum of elements is greater than the given number
     
  31. Find largest number possible from set of given numbers
     
  32. Find the smallest window in array sorting which will make the entire array sorted
     
  33. Find maximum sum path involving elements of given arrays
     
  34. Maximum profit earned by buying and selling shares any number of times
     
  35. Trapping Rain Water within given set of bars
     
  36. Longest Increasing Subsequence
     
  37. Longest Decreasing Subsequence Problem
     
  38. Find maximum product subarray in a given array
     
  39. Find maximum sum of subsequence with no adjacent elements
     
  40. Find minimum platforms needed in the station so to avoid any delay in arrival of any train
     
  41. Decode the array constructed from another array
     
  42. Sort an array using one swap
     
  43. Find Triplet with given sum in an array
     
  44. Length of longest continuous sequence with same sum in given binary arrays
     
  45. Rearrange array such that A[A[i]] is set to i for every element A[i]
     
  46. Reverse every consecutive m elements of the given subarray
     
  47. Maximum Product Subset Problem
     
  48. Find pairs with given difference k in the array
     
  49. Find pairs with given difference k in the array | Constant space solution
     
  50. 4 sum problem | Quadruplets with given sum
     
  51. Print all quadruplets with given sum | 4-sum problem extended
     
  52. Find odd occurring element in an array in single traversal
     
  53. Find two odd occurring element in an array without using any extra space
     
  54. Quickselect Algorithm
     
  55.  

  56. Merging Overlapping Intervals
     
  57. Activity Selection Problem
     
  58. Job Sequencing Problem with Deadlines
     
  59. Introduction to Priority Queues using Binary Heaps
     
  60. Min Heap and Max Heap Implementation in C++
     
  61. Min Heap and Max Heap Implementation in Java
     
  62. Heap Sort (Out-of-place and In-place implementation in C++ and C)
     
  63. Check if given array represents min heap or not
     
  64. Convert Max Heap to Min Heap in linear time
     
  65. Find K’th largest element in an array
     
  66. Sort a K-Sorted Array
     
  67. Merge M sorted lists of variable length
     
  68. Find K’th smallest element in an array
     
  69. Find smallest range with at-least one element from each of the given lists
     
  70. Merge M sorted lists each containing N elements
     
  71. Insertion sort | Iterative & Recursive
     
  72. Selection sort | Iterative & Recursive
     
  73. Bubble sort | Iterative & Recursive
     
  74. Merge Sort
     
  75. External merge sort
     
  76. Iterative Merge Sort Algorithm (Bottom-up Merge Sort)
     
  77. Quicksort
     
  78. Iterative Implementation of Quicksort
     
  79. Hybrid QuickSort
     
  80. Quicksort using Dutch National Flag Algorithm
     
  81. Quick Sort using Hoare’s Partitioning scheme
     
  82. Custom Sort | Sort elements by their frequency and Index
     
  83. Custom Sort | Sort elements of the array by order of elements defined by the second array
     
  84. Inversion Count of an array
     
  85. Segregate positive and negative integers in linear time
     
  86. Binary Search
     
  87. Ternary Search vs Binary search
     
  88. Interpolation search
     
  89. Exponential search
     
  90. Find number of rotations in a circularly sorted array
     
  91. Search an element in a circular sorted array
     
  92. Find first or last occurrence of a given number in a sorted array
     
  93. Count occurrences of a number in a sorted array with duplicates
     
  94. Find smallest missing element from a sorted array
     
  95. Find Floor and Ceil of a number in a sorted array
     
  96. Search in a nearly sorted array in O(logn) time
     
  97. Find number of 1’s in a sorted binary array
     
  98. Find the peak element in an array
     
  99. Maximum Sum Subarray using Divide & Conquer
     
  100. Find Minimum and Maximum element in an array using minimum comparisons
     
  101. Matrix Chain Multiplication
     
  102. 0-1 Knapsack problem
     
  103. Maximize value of the expression
     
  104. Partition problem
     
  105. Subset sum problem
     
  106. Minimum Sum Partition problem
     
  107. Rod Cutting
     
  108. Coin change-making problem (unlimited supply of coins)
     
  109. Coin Change Problem (Total number of ways to get the denomination of coins)
     
  110. Longest alternating subsequence
     
  111. Combinations of words formed by replacing given numbers with corresponding alphabets
     
  112. Decode the given sequence to construct minimum number without repeated digits
     
  113. All combinations of elements satisfying given constraints
     
  114. Print all Triplets that forms Arithmetic Progression
     
  115. Print all triplets that forms Geometric Progression
     
  116. Find Missing Term in a Sequence in log(n) time
     
  117. Print all distinct Subsets of a given Set
     
  118. Find Floor and Ceil of a number in a sorted array (Recursive solution)
     
  119. Set both elements of a binary array to 0 in single line
     
  120. K-Partition Problem | Printing all Partitions
     
  121. 3 Partition Problem
     
  122. 3-partition problem extended | Print all partitions
     
  123. Find two duplicate elements in an limited range array (using XOR)
     
  124. Find missing number and duplicate elements in an array
     
  125. Find Minimum and Maximum element in an array by doing minimum comparisons
     
  126. Find Frequency of each element in a sorted array containing duplicates
     
  127. Difference between Subarray, Subsequence and Subset
     



 
 

Thank you for being with us. 🙂

 




Leave a Reply

Notify of
avatar
wpDiscuz