觀念
Prefix Sum 用於快速、频繁地計算一個索引區間内的元素之和。
1 | array = [-2 0 3 -5 2 -1] |
Prefix diff
1 | array = [8 2 6 3 1] |
題目
Prefix Sum
- 303 Range Sum Query - Immutable (Easy)
- 304 Range Sum Query 2D - Immutable (Medium)
- Subarray Sum Equals K (Medium)
Different Sum
- 1094 Car Pooling (Medium)
- 1109 Corporate Flight Bookings (Medium)