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

  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. Quicksort
  76. Iterative Implementation of Quicksort
  77. Hybrid QuickSort
  78. Quicksort using Dutch National Flag Algorithm
  79. Quick Sort using Hoare’s Partitioning scheme
  80. External merge sort
  81. Custom Sort | Sort elements by their frequency and Index
  82. Custom Sort | Sort elements of the array by order of elements defined by the second array
  83. Inversion Count of an array
  84. Segregate positive and negative integers in linear time
  85. Binary Search
  86. Ternary Search vs Binary search
  87. Interpolation search
  88. Exponential search
  89. Find number of rotations in a circularly sorted array
  90. Search an element in a circular sorted array
  91. Find first or last occurrence of a given number in a sorted array
  92. Count occurrences of a number in a sorted array with duplicates
  93. Find smallest missing element from a sorted array
  94. Find Floor and Ceil of a number in a sorted array
  95. Search in a nearly sorted array in O(logn) time
  96. Find number of 1’s in a sorted binary array
  97. Find the peak element in an array
  98. Maximum Sum Subarray using Divide & Conquer
  99. Find Minimum and Maximum element in an array using minimum comparisons
  100. Matrix Chain Multiplication
  101. 0-1 Knapsack problem
  102. Maximize value of the expression
  103. Partition problem
  104. Subset sum problem
  105. Minimum Sum Partition problem
  106. Rod Cutting
  107. Coin change-making problem (unlimited supply of coins)
  108. Coin Change Problem (Total number of ways to get the denomination of coins)
  109. Longest alternating subsequence
  110. Combinations of words formed by replacing given numbers with corresponding alphabets
  111. Decode the given sequence to construct minimum number without repeated digits
  112. All combinations of elements satisfying given constraints


Thank you for being with us. 🙂


Leave a Reply

Notify of