CodeMosa

Master LeetCode Patterns

4 Problems

Segment Tree Practice Problems

Range sum/min/max with point updates; lazy propagation for range updates; coordinate compression as needed.

Back to Collections

Relevant Patterns

#
Study these pattern guides before tackling the problems. Understanding the core concepts will help you solve them more efficiently.

Practice Problems

#
Show 2 hints
  • Build tree over indices; update and query in O(log n).
  • Fenwick is an alternative; segment tree more general.
Show 2 hints
  • Coordinate compress positions; segment tree for range max with updates.
  • Track global maximum after each drop.
Show 2 hints
  • Segment tree or sweep with ordered map to track overlaps.
  • Answer is peak overlap count after each booking.
Show 2 hints
  • 2D segment tree or BIT; consider memory tradeoffs.
  • Naive per‑query sum will TLE; need log^2 structure.

Track Your Progress

Mark problems as complete as you solve them. Come back anytime to continue where you left off.