// TOPIC
#prefix-sums
2 articles
◆◆◆AdvancedGoogle
01Fenwick Trees (Binary Indexed Trees)
Fenwick trees deliver O(log n) prefix sums and point updates in ~10 lines of code. Master the lowbit trick and know when a BIT beats a segment tree.
#fenwick-tree#binary-indexed-tree#prefix-sums
15 min◆◆IntermediateAmazonGoogle
02Prefix Sums
Precompute running totals so any range sum becomes one subtraction. The prefix sum technique turns O(n) per query into O(1) — and the hashmap combo unlocks a whole class of subarray counting problems.
#arrays#prefix-sums#techniques
10 min