Range Sum Query - Mutable
MediumLeetCodeSegment Tree & Fenwick Tree
Approach hintTry it first, then revealHide
A Fenwick tree gives point updates and prefix sums in O(log n). Keep a copy of the array so that update can add the difference between the new and the old value.