Basic Array Questions
1>Find the maximum and minimum element in an array.|/
2>Reverse an array.|/
3>Find the "Kth" largest and smallest element in an array.|/
4> Sort an array of 0s, 1s, and 2s (Dutch National Flag problem).|/
5>Move all negative numbers to one side of the array.|/
6>Union and Intersection of two sorted arrays. ??
8>Find the missing number in an array of size 𝑛 n containing numbers from 0 to n.
7>Cyclically rotate an array by one. |/
9>Find the duplicate number in an array of n+1 |/
10>Merge two sorted arrays without extra space.|/
// Intermediate Array Questions
11> Kadane's algorithm: Maximum subarray sum.|/
12> Find the longest consecutive subsequence.
14> Find the majority element in an array (appearing more than 𝑛/2 n/2 times)
13> Trapping Rainwater problem.
.15> Search for an element in a rotated sorted array.
16>Find a pair in an array with a given sum.|/
17>Find the triplet in an array that sums up to a given number.
18>Find the smallest subarray with a sum greater than a given value.
19>Rearrange an array in alternating positive and negative items.
20>Spiral traversal of a matrix.
Sorting and Searching
21>Binary search in a sorted array. |/
22>Find the floor and ceiling of an element in a sorted array.
23>Find the first and last occurrence of an element in a sorted array.
25>Quickselect: Find 𝑘 k-th smallest/largest element.
24>Count inversions in an array.
26>Find the median of two sorted arrays.
27>Find the peak element in an array.
28>Smallest missing positive number.
29>Subarray with a given XOR.
Merge Intervals.
32>Maximum sum subarray of size 𝑘 |/
31>Sliding Window and Two Pointers|/
34>Longest subarray with at most 𝑘 distinct characters.
33>Longest substring without repeating characters.
35>Count subarrays with a given sum.
36>Minimum window substring.
37>Longest repeating character replacement.
39>Max consecutive ones (or at most 𝑘 zeroes allowed).
38>Longest subarray with equal 0s and 1s.
40>Container with the most water.
41>Minimum swaps required to group all 1s together.
Advanced Array Problems
42>Find the maximum product subarray. |/
43>Maximum length of a bitonic subarray.
44>Maximum sum of non-adjacent elements.
45>Maximum circular subarray sum.
46>Count all subarrays with a sum divisible by 𝑘
47>Find all subarrays with a given XOR.
49>Count distinct elements in every window of size 𝑘
48>Maximum number of chunks to make the array sorted.
51>Subarray with product less than 𝑘.
50>Find the repeated and missing numbers.