25 Array Problems To Revise Before Interviews
After posting graph and tree patterns, today I've curated 25 carefully selected Array problems covering every major pattern for interviews. Arrays are the most frequently asked topic in coding interviews.
The 25 Essential Problems
1. Two Sum - LeetCode 1
- Pattern: Hash map for complements
- Why: Most asked problem ever, foundation for pair problems
- Companies: Amazon, Google, Meta, Microsoft, Apple
2. Container With Most Water - LeetCode 11
- Pattern: Two pointers optimization
- Why: Classic greedy two-pointer approach
- Companies: Amazon, Meta, Bloomberg, Google
3. 3Sum - LeetCode 15
- Pattern: Sorted array + two pointers
- Why: Foundation for k-sum problems
- Companies: Meta, Amazon, Microsoft, Adobe
4. Trapping Rain Water - LeetCode 42
- Pattern: Two pointers with max tracking
- Why: Tests understanding of optimal space solutions
- Companies: Amazon, Google, Meta, Microsoft
5. Longest Substring Without Repeating Characters - LeetCode 3
- Pattern: Sliding window with hash set
- Why: Classic sliding window introduction
- Companies: Amazon, Meta, Google, Adobe
6. Minimum Window Substring - LeetCode 76
- Pattern: Sliding window with frequency map
- Why: Hard sliding window, highly asked
- Companies: Meta, Amazon, Google, Uber
7. Maximum Subarray (Kadane's Algorithm) - LeetCode 53
- Pattern: Kadane's algorithm
- Why: Foundation for subarray optimization
- Companies: Amazon, Microsoft, LinkedIn, Bloomberg
8. Maximum Product Subarray - LeetCode 152
- Pattern: Modified Kadane's with min/max tracking
- Why: Handles negative numbers elegantly
- Companies: Amazon, Microsoft, Meta, Google
9. Subarray Sum Equals K - LeetCode 560
- Pattern: Prefix sum + hash map
- Why: Classic prefix sum application
- Companies: Meta, Amazon, Google, Microsoft
10. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit - LeetCode 1438
- Pattern: Sliding window with monotonic deque
- Why: Advanced sliding window technique
- Companies: Google, Amazon, Meta
11. Search in Rotated Sorted Array - LeetCode 33
- Pattern: Modified binary search
- Why: Tests binary search understanding
- Companies: Amazon, Meta, Microsoft, LinkedIn
12. Find First and Last Position of Element in Sorted Array - LeetCode 34
- Pattern: Binary search for boundaries
- Why: Double binary search technique
- Companies: Meta, Amazon, Google, Microsoft
13. Merge Intervals - LeetCode 56
- Pattern: Sorting + greedy merging
- Why: Core pattern for interval problems
- Companies: Meta, Amazon, Google, Microsoft, Bloomberg
14. Insert Interval - LeetCode 57
- Pattern: Interval manipulation
- Why: Tests edge case handling
- Companies: Google, Meta, Amazon, LinkedIn
15. Kth Largest Element in an Array - LeetCode 215
- Pattern: Quickselect / Heap
- Why: Foundation for selection problems
- Companies: Meta, Amazon, Microsoft, Adobe
16. Product of Array Except Self - LeetCode 238
- Pattern: Prefix/suffix products
- Why: No-division constraint teaches optimization
- Companies: Amazon, Meta, Microsoft, Apple
17. Rotate Array - LeetCode 189
- Pattern: Reversal algorithm
- Why: Tests in-place manipulation
- Companies: Microsoft, Amazon, Meta
18. Next Permutation - LeetCode 31
- Pattern: Two-pass with swapping
- Why: Complex manipulation with clear logic
- Companies: Google, Amazon, Meta, Bloomberg
19. Find All Duplicates in an Array - LeetCode 442
- Pattern: Index marking technique
- Why: O(1) space without modifying (marking negatives)
- Companies: Amazon, Microsoft, Meta
20. Set Matrix Zeroes - LeetCode 73
- Pattern: In-place marking using first row/column
- Why: Classic space optimization problem
- Companies: Amazon, Microsoft, Meta, Apple
21. Longest Consecutive Sequence - LeetCode 128
- Pattern: Hash set for O(n) solution
- Why: Tests ability to optimize beyond sorting
- Companies: Google, Amazon, Meta, Uber
22. Best Time to Buy and Sell Stock - LeetCode 121
- Pattern: Single-pass min tracking
- Why: Foundation for all stock problems
- Companies: Amazon, Microsoft, Meta, Bloomberg
23. Best Time to Buy and Sell Stock III - LeetCode 123
- Pattern: State machine DP
- Why: Advanced optimization with constraints
- Companies: Google, Amazon, Meta
24. Spiral Matrix - LeetCode 54
- Pattern: Layer-by-layer traversal
- Why: Tests boundary handling and simulation
- Companies: Amazon, Microsoft, Meta, Apple
25. Jump Game II - LeetCode 45
- Pattern: Greedy with range tracking
- Why: Advanced greedy technique
- Companies: Amazon, Google, Meta, Bloomberg
These 25 problems are your foundation for Arrays. Master them, and you'll handle the majority of array questions thrown at you in interviews.
Good luck with your preparation! 🚀