Top 40 Interview Problems on Arrays

1Minimum Copy Paste OperationsMedium
2Count and print all Subarrays with product less than K in O(n)Expert
3Sum of all sub arrays in O(n) TimeExpert
4Sliding Window Algorithm (Track the maximum of each subarray of size k)Expert
5Divide and Conquer – Rearrange array elements in special orderMedium
6Remove the duplicates from the given StringMedium
7Find median of two sorted arrays of same sizeMedium
8Find two non-repeating numbers in an array in O(n) time and O(1) spaceExpert
9All elements appears thrice and one element appears once. Find that element in O(n) time and O(1) spaceExpert
10Majority Element– Boyer–Moore majority vote algorithmMedium
11Stock Single Sell Problem — O(n) SolutionExpert
12Maximum Subarray OR Largest Sum Contiguous Subarray Problem – Divide and ConquerMedium
13Find the two repeating elements in a given array | 6 ApproachesMedium
14Find duplicates in an given array in O(n) time and O(1) extra spaceEasy
15Find longest Snake sequence in a given matrixMedium
16Count all paths in 2D Matrix with Obstructions in itMedium
17Print All Diagonals of a given matrixMedium
18Kadane’s Algorithm — Maximum Subarray ProblemMedium
19Shortest Range in K-sorted ListsExpert
20Generate Maximum revenue by selling K tickets from N windowsMedium
21Merge K Sorted ArraysExpert
22Rearrange the Array of Given Range N, such that A[i]=iMedium
23Binary Min — Max HeapExpert
24Magic Index — Find Index In Sorted Array Such That A[i] = i.Easy
25Print All the Subsets of a Given Set (Power Set)Expert
26Track the Maximum Element in a Stack.Medium
27Print All Possible Valid Combinations Of Parenthesis of Given ‘N’Expert
28Counting SortMedium
29Check if Array is Consecutive IntegersEasy
30In an Array, find the Smallest Subarray with Sum Greater than the Given ValueEasy
31Rearrange Positive and Negative Elements at Alternate Positions in an Array In O(1) Extra SpaceExpert
32Given an array arrA[], find the maximum j – i such that arr[j] > arr[i].Medium
33Find All Elements in an Array which appears more than N/K times, N is Array Size and k is a Number.Expert
34Sorted Array to Binary Search Tree of Minimal HeightMedium
35Print All Paths from Top left to bottom right in Two Dimensional ArrayMedium
36Rearrange Positive and Negative Numbers of Array On Each Side in O(nlogn)Expert
37Find The Longest Sequence Of Prefix Shared By All The Words In A StringExpert
38Print All Elements of Two Dimensional Array in SpiralMedium
39Merge Sort — Updated — Most Efficient ways to ImplementMedium
40Binary SearchEasy