Prefix Sum
Precompute running totals so the sum of any range is a single subtraction. Pair it with a hash map when you need subarrays with a given sum, as in Subarray Sum Equals K. It turns repeated range sums from linear into constant time.
15 problems · 6 with a video · 3 to practice in an AI round
| # | Problem | Difficulty | Video | AI round |
|---|---|---|---|---|
| 1 | Product of Array Except Self | Medium | AI round | |
| 2 | Subarray Sum Equals K | Medium | AI round | |
| 3 | Find Pivot Index | Easy | AI round | |
| 4 | Contiguous Array | Medium | ||
| 5 | Running Sum of 1d Array | Very easy | — | |
| 6 | Subarray Sums Divisible by K | Medium | — | |
| 7 | Continuous Subarray Sum | Medium | — | |
| 8 | Find the Highest Altitude | Very easy | — | |
| 9 | Make Sum Divisible by P | Medium | — | |
| 10 | Maximum Size Subarray Sum Equals k | Medium | ||
| 11 | Corporate Flight Bookings | Medium | — | |
| 12 | Maximum Population Year | Easy | — | |
| 13 | Left and Right Sum Differences | Very easy | ||
| 14 | Ways to Make a Fair Array | Medium | — | |
| 15 | Minimum Moves to Make Array Complementary | Medium | — |
Sort by what interviews ask
Sign in to see how many companies ask each problem, sort all 500 by it or by likes, and tick off what you solve.
Practice in an AI round
Three of these are AI rounds: 30 minutes, an AI agent beside your code, then a scored report.
Practice Product of Array Except Self in an AI roundYour first AI round is free.