Least You Need to Know: Fenwick Trees, Prefix Sums, and Low-Bit Jumps
Open lesson
Fenwick trees support prefix-sum queries and point updates in
O(log n) by storing carefully chosen partial sums. The key bit trick is the low bit, which tells how large a range each index is responsible for.