02. Arrays
🧠Arrays Strategy
- Prefix Sum: Use when querying sums in a range multiple times
O(1). - Carry Forward: Track "max so far" or "min so far" to solve in
O(N). - Two Pointers: Great for finding pairs in sorted arrays or trapping water.
- Binary Search: Look for the Search Space. Is it the array index? Or is it the answer itself (Binary Search on Answer)?
🟢 Basics & Prefix Sum
- Rotation Game
- Good Pair
- Max And Min Of An Array
- Reverse The Array
- Search Element
- Second Largest
- Minimum Picks
- Separate Odd Even
- Multiple Left Rotations
- Equilibrium Index
- Range Sum Query
- Product Array Puzzle
- Pick From Both Sides
- Time To Equality
- Count Ways Make Sum Equal
🟡 Subarrays & Carry Forward
- Max Sum Contiguous Subarray
- Rain Water Trapped
- Special Subsequences AG
- Bulbs
- Closest MinMax
- Amazing Subarrays
- Leaders In An Array
- Even Subarrays
- Maximum Absolute Difference
- Flip
- Max Non Negative SubArray
- Add One To Number
- Continuous Sum Query
🟠2D Matrices
- Spiral Order Matrix II
- Rotate Matrix
- Matrix Multiplication
- Matrix Transpose
- Search Row Col Sorted Matrix
- Row To Column Zero
- Anti Diagonals
- Sum Of All Submatrices
- Sub Matrix Sum Queries
- Maximum Sum Square SubMatrix
- Matrix Search
- Matrix Median
🟣 Two Pointers & Swaps
- Container With Most Water
- Three Sum
- Three Sum Zero
- Pairs With Given Difference
- Pairs With Given Sum II
- Sort By Color
- Array Three Pointers
- Minimize Absolute Difference
- Minimum Swaps
- Minimum Swaps 2
- Max Distance
🔵 Binary Search
- Sorted Insert Position
- Search For A Range
- Find Peak Element
- Single Element Sorted Array
- Square Root Integer
- Rotated Sorted Array Search
- Search Bitonic Array
- Special Integer
- Ath Magical Number
- Kth Price
🔴 Binary Search on Answer
📚 Other Problems
- Add The Matrices
- Alternating Subarrays Easy
- Another Count Rectangles
- Are Matrices Same
- Closest Pair Sorted Arrays
- Column Sum
- Count Pairs Given Sum
- Counting Subarrays Easy
- Good Subarrays Easy
- Little Ponny Maximum Element
- Main Diagonal Sum
- Matrix Scalar Product
- Matrix Subtraction
- Maximum Subarray Easy
- Minor Diagonal Sum
- Row Sum
- Subarray Least Average
- Subarray With Given Sum
- Sum Of All Subarrays