Segment Trees and Fenwick Tree — Complete Interview Guide
Master Segment Trees and Binary Indexed Trees for FAANG interviews: range sum, min, max queries, point updates, lazy propagation, 2D BIT, and full problem index with complexity reference.
5 articles
Master Segment Trees and Binary Indexed Trees for FAANG interviews: range sum, min, max queries, point updates, lazy propagation, 2D BIT, and full problem index with complexity reference.
Track range coverage with addRange, removeRange, and queryRange. Maintain disjoint intervals in a sorted map for amortized O(log n) — the canonical interview problem for interval merging logic.
Track the tallest stack height as squares fall onto a number line. The textbook problem for segment trees with lazy propagation, range max queries, and range-assign updates.
Solve LeetCode 732 My Calendar III using a sweep-line difference array in O(n) per booking, then upgrade to a dynamic lazy segment tree with coordinate compression for O(log n) range updates and max queries.
Complete Segment Tree and Fenwick Tree cheatsheet for FAANG interviews: BIT template, segment tree template, lazy propagation, 2D BIT, decision guide, and full problem index.