Arrays Topic Wise Problem-Solving Questions
1. Two-Pointer Technique
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Two Sum (Sorted) | Easy | Link | Link |
| 2 | Remove Duplicates | Easy | Link | Link |
| 3 | Container With Most Water | Medium | Link | Link |
| 4 | Move Zeroes | Easy | Link | Link |
| 5 | Valid Palindrome | Easy | Link | Link |
| 6 | Merge Sorted Arrays | Easy | Link | Link |
| 7 | 3Sum | Medium | Link | Link |
| 8 | Trapping Rain Water | Hard | Link | Link |
| 9 | 3Sum Closest | Medium | Link | Link |
| 10 | Sort Colors | Medium | Link | Link |
| 11 | Minimum Window Substring | Hard | Link | Link |
| 12 | Count Triplets (Sum < K) | Medium | - | Link |
| 13 | Equal Sum Partition | Medium | - | Link |
2. Sliding Window Technique
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Max Sum Subarray (Size K) | Easy | Link | Link |
| 2 | Smallest Subarray (Sum ≥ Target) | Medium | Link | Link |
| 3 | Longest Substring (Unique Chars) | Medium | Link | Link |
| 4 | Fruit Into Baskets | Medium | Link | Link |
| 5 | Permutation in String | Medium | Link | Link |
| 6 | Longest Subarray (Sum = K) | Medium | Link | Link |
| 7 | Max Element in K-Sized Window | Hard | Link | Link |
| 8 | Longest Substring (≤ K Unique Chars) | Medium | Link | Link |
| 9 | Subarrays with Product < K | Medium | Link | Link |
| 10 | Max Consecutive Ones III | Medium | Link | Link |
3. Binary Search on Arrays
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Binary Search | Easy | Link | Link |
| 2 | Search in Rotated Sorted Array | Medium | Link | Link |
| 3 | First/Last Position of Element | Medium | Link | Link |
| 4 | Find Peak Element | Medium | Link | Link |
| 5 | Square Root of X | Easy | Link | Link |
| 6 | Find K Closest Elements | Medium | Link | Link |
| 7 | Split Array Largest Sum | Hard | Link | Link |
4. Cyclic Rotations & Reversals
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Reverse Array | Easy | - | Link |
| 2 | Find Minimum in Rotated Sorted Array | Medium | Link | Link |
| 3 | Reverse Words in String | Medium | Link | Link |
| 4 | Circular Array Loop | Medium | Link | Link |
| 5 | Rotate Array (Reversal Method) | Medium | Link | Link |
| 6 | Check Rotation of Arrays | Easy | - | Link |
5. Frequency Counting (Hashing)
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Two Sum (Unsorted) | Easy | Link | - |
| 2 | Majority Element | Easy | Link | - |
| 3 | All Duplicates | Medium | Link | - |
| 4 | First Missing Positive | Hard | Link | - |
| 5 | Anagram Grouping | Medium | Link | - |
| 6 | Count Frequency | Easy | - | Link |
| 7 | Non-repeating Element | Easy | Link | - |
| 8 | Top K Frequent Elements | Medium | Link | - |
| 9 | Longest Harmonious Subsequence | Easy | Link | - |
| 10 | Contiguous Array | Medium | Link | - |
| 11 | Subarray Sums Divisible by K | Medium | Link | - |
| 12 | Majority Element (> n/2) | Easy | Link | - |
| 13 | Freq > n/3 | Medium | Link | - |
| 14 | Group Frequency | Medium | - | Link |
6. Swap & Reorder Techniques
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Dutch National Flag | Medium | Link | - |
| 2 | Move Negative Numbers to Left | Easy | - | Link |
| 3 | Segregate Even and Odd | Easy | - | Link |
| 4 | Cyclic Sort | Medium | - | Link |
| 5 | Minimum Swaps to Sort Array | Medium | - | Link |
| 6 | Move Zeros | Easy | Link | - |
| 7 | Rearrange Array (Alternate +ve & -ve) | Medium | - | Link |
| 8 | Kth Largest in Array | Medium | Link | - |
| 9 | Reorganize String | Medium | Link | - |
| 10 | Max Even Sum | Medium | - | Link |
| 11 | Parity Sort | Easy | Link | - |
| 12 | Min Swap (Elements < K Together) | Medium | - | Link |
| 13 | Wave Form | Easy | - | Link |
7. Prefix Sum (Cumulative Sum)
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Range Sum Query | Easy | Link | - |
| 2 | Equilibrium Index | Easy | - | Link |
| 3 | Subarray Sum Equals K | Medium | Link | - |
| 4 | Maximum Subarray (Kadane's) | Easy | Link | - |
| 5 | Product Except Self | Medium | Link | - |
| 6 | Subarray Sum = 0 | Easy | - | Link |
| 7 | Subarray Count (Given Sum) | Medium | - | Link |
| 8 | Random Pick with Weight | Medium | Link | - |
| 9 | Subarray Sum Equals K (Negatives) | Medium | Link | - |
| 10 | Maximum Size Subarray (Sum = K) | Medium | - | Link |
| 11 | Count Number of Nice Subarrays | Medium | Link | - |
| 12 | Subarray Division (Divisible by K) | Medium | Link | - |
| 13 | Subarray 1s & 0s (Equal Count) | Medium | Link | - |
| 14 | Max Sum (Even Length Subarray) | Easy | - | Link |
| 15 | Sum = Target (Count Subarrays) | Medium | Link | - |
8. In-Place Problems
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Remove Element | Easy | Link | - |
| 2 | Remove Duplicates (Sorted) | Easy | Link | - |
| 3 | Merge Sorted Arrays | Easy | Link | - |
| 4 | Replace with Next Greatest | Easy | - | Link |
| 5 | Missing Positive | Hard | Link | - |
| 6 | Rotate Array | Medium | Link | - |
| 7 | Reverse an Array | Easy | - | Link |
| 8 | Set Matrix Zeroes | Medium | Link | - |
| 9 | Wiggle Sort | Medium | Link | - |
| 10 | Equal Sum (3-Partition) | Medium | Link | - |
| 11 | Sort Colors | Medium | Link | - |
| 12 | Next Greater (Replace Elements) | Easy | - | Link |
9. Palindrome-Related Problems
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Palindrome String | Easy | Link | - |
| 2 | Palindrome Array | Easy | - | Link |
| 3 | Palindrome Number | Easy | Link | - |
| 4 | Palindrome Subarray | Medium | Link | - |
| 5 | Minimum String Palindrome | Hard | Link | - |
| 6 | Longest Palindromic Subsequence | Medium | Link | - |
| 7 | Palindrome Partitioning | Medium | Link | - |
| 8 | Shortest Palindrome | Hard | Link | - |
| 9 | Palindrome Pairs | Hard | Link | - |
| 10 | Palindrome Digit | Easy | - | Link |
| 11 | Palindromic Form (Min Changes) | Medium | - | Link |
2D Array Problem Solving Questions
1. Row-wise & Column-wise Traversal
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Print matrix row-wise and column-wise | Easy | - | Link |
| 2 | Find row with maximum sum | Easy | - | Link |
| 3 | Print elements greater than X | Easy | - | Link |
| 4 | Find the Kth Smallest Sum of a Matrix With Sorted Rows | Hard | - | - |
| 5 | Print alternate rows/columns | Easy | - | Link |
| 6 | Check if any column is entirely zero | Easy | - | Link |
2. Diagonal Traversal
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Print primary diagonal | Easy | - | Link |
| 2 | Print secondary diagonal | Easy | - | Link |
| 3 | Sum of both diagonals | Easy | Link | Link |
| 4 | Swap major and minor diagonals of a square matrix | Easy | - | Link |
| 5 | Check identical diagonals | Easy | - | Link |
3. Transpose Matrix
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Transpose square matrix | Easy | Link | Link |
| 2 | Transpose non-square matrix | Medium | - | Link |
| 3 | Check symmetric matrix | Easy | - | Link |
| 4 | Check skew-symmetric matrix | Easy | - | Link |
| 5 | Transpose sparse matrix | Medium | - | Link |
| 6 | Verify orthogonal matrix | Medium | - | Link |
4. Matrix Rotation
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Rotate 90° clockwise | Medium | Link | Link |
| 2 | Rotate 180° | Medium | - | Link |
| 3 | Rotate anti-clockwise | Medium | - | Link |
| 4 | Rotate submatrix | Medium | - | Link |
| 5 | Rotate matrix layers | Hard | - | Link |
| 6 | Rotate a ring | Hard | - | Link |
5. Search in Sorted 2D Matrix
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Search in sorted matrix | Medium | Link | Link |
| 2 | Count occurrences of K | Medium | - | Link |
| 3 | Find position of K | Medium | Link | Link |
| 4 | Find median | Hard | Link | Link |
| 5 | Find smallest > K | Medium | - | Link |
| 6 | Search with duplicates | Medium | - | Link |
5. Spiral Traversal
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Print spiral order | Medium | Link | Link |
| 2 | Find Kth in spiral | Medium | - | Link |
| 3 | Spiral reverse print | Medium | - | Link |
| 4 | Store in 1D array | Medium | - | Link |
| 5 | Replace with primes | Medium | - | - |
| 6 | Matrix spiral | Medium | - | Link |
6. Boundary Traversal
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Print boundary | Easy | - | Link |
| 2 | Sum boundary | Easy | - | - |
| 3 | Count corners | Easy | - | - |
| 4 | Product boundary | Easy | - | - |
| 5 | ASCII boundary | Easy | - | - |
| 6 | Palindrome boundary | Easy | - | - |
7. Count Zeros/Ones
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Count 0s | Easy | - | Link |
| 2 | Find the row with maximum number of 1s | Easy | - | Link |
| 3 | Row with max 1s | Easy | Link | Link |
| 4 | Count 0s islands | Medium | - | Link |
| 5 | Distance from 0 | Medium | Link | Link |
8. Sum of Rows/Columns
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Print row/column sums | Easy | - | Link |
| 2 | Row with highest sum | Easy | - | Link |
| 3 | Check equal row sums | Easy | - | Link |
| 4 | Making Row and Column Sums Equal | Easy | - | Link |
| 5 | Longest even sequence column | Medium | - | Link |
| 6 | Check magic square | Easy | - | Link |
9. Prefix Sum Matrix
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Compute prefix sum | Medium | - | Link |
| 2 | Submatrix sum query | Medium | Link | Link |
| 3 | Submatrix average | Medium | - | Link |
| 4 | Count submatrices sum K | Hard | Link | Link |
| 5 | Maximum sum rectangle in a 2D matrix | Hard | - | Link |
10. In-place Swaps
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Diagonal swap | Medium | - | Link |
| 2 | Interchange Two Random Rows in a Matrix | Easy | - | Link |
| 3 | Transpose in-place | Easy | Link | Link |
| 4 | Reverse rows/columns | Easy | - | - |
| 5 | Swap alternate rows | Easy | - | - |
| 6 | Random shuffle | Medium | - | - |
11. Max Submatrix Sum
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Max sum submatrix | Medium | - | - |
| 2 | Max sum rectangle | Hard | Link | Link |
| 3 | Largest all-1s area | Hard | Link | Link |
| 4 | maximum-sum-2-x-2-submatrix-in-a-matrix/ | Medium | - | Link |
| 5 | Uniform max sum rectangle | Medium | - | Link |
12. Flip Operations
| S.No | Problem Statement | Difficulty | LeetCode | GeeksforGeeks |
|---|---|---|---|---|
| 1 | Horizontal flip | Easy | Link | - |
| 2 | Vertical flip | Easy | - | - |
| 3 | Mirror image | Easy | - | - |
| 4 | Quadrant flip | Medium | - | - |
| 5 | Conditional flip | Medium | - | - |
| 6 | Diagonal flip | Medium | - | - |