Segment trees and Fenwick trees are powerful, but sometimes overkill.
What if I told you there's a simpler technique that handles many range query problems with just array indexing?
Sqrt decomposition divides your array into blocks of size . Queries touch at most blocks, and updates affect just one block.
The complexity is worse than logarithmic structures, but the simplicity often wins.
In this section, you'll learn block decomposition, range queries with blocks, and MO's algorithm for offline queries. Sometimes simple beats clever.