Problems › Topics › Prefix sums
Prefix sums practice problems
Carry the running total so any span is one subtraction away. A pattern: a move you make, and the kind of thing an interview is really asking you to spot. 9 problems in the bank train it, each with a worked example, a hint and a reference solution.
- Math
- Strings
- Arrays
- Hash maps
- Sorting
- Parsing
- Two pointers
- Sliding window
- Prefix sums
- Stacks
- Binary search
- Intervals
- Grids
- Greedy
- Recursion
- Simulation
- Bit manipulation
9 problems
- Running balance down a statementeasy
- The highest so fareasy
- The day the account went undereasy
- The average so far, after every readingeasy
- How many stretches add up to the figurehard
- Parcel discount bandmedium
- The imbalance across a splitmedium
- Answer a stack of range totalsmedium
- Where the ledger balancesmedium