~/problems
Problems
Basics first, then the classics, then company-style assessments. Every problem has tests you run right here; multi-level ones unlock as you go. See the roadmap.
Advanced & competitive
Range queries
Fenwick trees, segment trees, sparse tables.
12 problems
Advanced & competitive
Range queries Fenwick trees, segment trees, sparse tables.
Fenwick tree (BIT) guide
- Basics: which cells a Fenwick tree touches basics easy
- Deli counter: people ahead of you py · c++ · java easy
- Range sums with point updates py · c++ · java easy
- Count smaller elements to the right py · c++ · java medium
- Weighted random sampler with insert and remove Citadel hard
Segment tree (+ lazy propagation) guide
- Basics: build and update a bottom-up segment tree basics easy
- Greenhouse: hottest sensor in a range py · c++ · java easy
- Falling squares py · c++ · java hard
- Dynamic range minimum queries py · c++ · java easy
- Range add, point query py · c++ · java easy
Sparse table (static RMQ)
- Basics: build a sparse table basics py · c++ · java easy
- Tide gauge: rise and fall between two hours py · c++ · java easy