Skip to main content

Practice · 1 of 3

The Batch of Asks

CHALLENGE
Difficulty: advanced+25 XP

**Scenario.** q ≤ 200000 queries: 'how many of the n given intervals contain point p?' No updates. What is the intended structure? **Which approach is the best fit? The program only needs to print the letter.** **A)** A segment tree over coordinates storing interval counts **B)** Offline sweep: +1 at each l, −1 at each r+1, sort, running sum answers each p in order **C)** For each query, loop over all intervals **D)** A balanced BST of interval endpoints

Back to lesson: Practice: Offline Synthesis Drills