Given a static array of integers and queries, find the minimum in each queried range. You're solving the canonical Sparse Table problem.
With queries, the query time is needed. Compare:
- Naive: . Too slow
- Segment Tree:
- Sparse Table: For and :
- Segment Tree: ~ operations
- Sparse Table: ~ operations (after preprocessing) Constraints: up to , up to .