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. Find sub-array with 0 sum
     
  3. Sort binary array in linear time
     
  4. Find a duplicate element in a limited range array
     
  5. Find largest sub-array formed by consecutive integers
     
  6. Find maximum length sub-array having given sum
     
  7. Find maximum length sub-array having equal number of 0’s and 1’s
     
  8. Sort an array containing 0’s, 1’s and 2’s(Dutch national flag problem)
     
  9. Inplace merge two sorted arrays
     
  10. Merge two arrays by satisfying given constraints
     
  11. Find index of 0 to replaced to get maximum length sequence of continuous ones
     
  12. Find maximum product of two integers in an array
     
  13. Shuffle a given array of elements (Fisher–Yates shuffle)
     
  14. Rearrange the array with alternate high and low elements
     
  15. Find equilibrium index of an array
     
  16. Find majority element in an array (Boyer–Moore majority vote algorithm)
     
  17. Move all zeros present in the array to the end
     
  18. Replace each element of array with product of every other element without using / operator
     
  19. Find Longest Bitonic Subarray in an array
     
  20. Find maximum difference between two elements in the array by satisfying given constraints
     
  21. Maximum subarray problem (Kadane’s algorithm)
     
  22. Maximum Sum Circular Subarray
     
  23. Find all distinct combinations of given length
     
  24. Find all distinct combinations of given length with repetition allowed
     
  25. Find maximum sequence of continuous 1’s formed by replacing at-most k zeroes by ones
     
  26. Find minimum sum subarray of given size k
     
  27. Find subarray having given sum in given array of integers
     
  28. Find the length of smallest subarray whose sum of elements is greater than the given number
     
  29. Find largest number possible from set of given numbers
     
  30. Find the smallest window in array sorting which will make the entire array sorted
     
  31. Find maximum sum path involving elements of given arrays
     
  32. Maximum profit earned by buying and selling shares any number of times
     
  33. Trapping Rain Water within given set of bars
     
  34. Longest Increasing Subsequence
     
  35. Find maximum product subarray in a given array
     
  36. Find maximum sum of subsequence with no adjacent elements
     
  37. Find minimum platforms needed in the station so to avoid any delay in arrival of any train
     
  38. Decode the array constructed from another array
     
  39. Sort an array using one swap
     
  40. Find Triplet with given sum in an array
     
  41. Length of longest continuous sequence with same sum in given binary arrays
     
     
  42. Merging Overlapping Intervals
     
  43. Activity Selection Problem
     
  44. Job Sequencing Problem with Deadlines
     
  45. Introduction to Priority Queues using Binary Heaps
     
  46. Min Heap and Max Heap Implementation in C++
     
  47. Heap Sort (Out-of-place and In-place implementation in C++ and C)
     
  48. Check if given array represents min heap or not
     
  49. Convert Max Heap to Min Heap in linear time
     
  50. Find K’th largest element in an array
     
  51. Sort a K-Sorted Array
     
  52. Merge M sorted lists of variable length
     
  53. Find K’th smallest element in an array
     
  54. Find smallest range with at-least one element from each of the given lists
     
  55. Merge M sorted lists each containing N elements
     
  56. Insertion sort | Iterative & Recursive
     
  57. Selection sort | Iterative & Recursive
     
  58. Bubble sort | Iterative & Recursive
     
  59. Merge Sort
     
  60. Quicksort
     
  61. Iterative Implementation of Quicksort
     
  62. Hybrid QuickSort
     
  63. Quicksort using Dutch National Flag Algorithm
     
  64. Quick Sort using Hoare’s Partitioning scheme
     
  65. External merge sort
     
  66. Custom Sort | Sort elements by their frequency and Index
     
  67. Custom Sort | Sort elements of the array by order of elements defined by the second array
     
  68. Inversion Count of an array
     
  69. Segregate positive and negative integers in linear time
     
  70. Binary Search
     
  71. Ternary Search vs Binary search
     
  72. Interpolation search
     
  73. Exponential search
     
  74. Find number of rotations in a circularly sorted array
     
  75. Search an element in a circular sorted array
     
  76. Find first or last occurrence of a given number in a sorted array
     
  77. Count occurrences of a number in a sorted array with duplicates
     
  78. Find smallest missing element from a sorted array
     
  79. Find Floor and Ceil of a number in a sorted array
     
  80. Search in a nearly sorted array in O(logn) time
     
  81. Find number of 1’s in a sorted binary array
     
  82. Find the peak element in an array
     
  83. Maximum Sum Subarray using Divide & Conquer
     
  84. Find Minimum and Maximum element in an array using minimum comparisons
     
  85. Matrix Chain Multiplication
     
  86. 0-1 Knapsack problem
     
  87. Maximize value of the expression
     
  88. Partition problem
     
  89. Subset sum problem
     
  90. Minimum Sum Partition problem
     
  91. Rod Cutting
     
  92. Coin change-making problem (unlimited supply of coins)
     
  93. Coin Change Problem (Total number of ways to get the denomination of coins)
     
  94. Longest alternating subsequence
     
  95. Combinations of words formed by replacing given numbers with corresponding alphabets
     
  96. Decode the given sequence to construct minimum number without repeated digits
     
  97. All combinations of elements satisfying given constraints
     



 
 

Thank you all for your valuable time and being with us. 🙂