Skip to main content

Practice · 4 of 6

Clinic: The Missing First Element

CHALLENGE
Difficulty: advanced+25 XP

**Bài toán.** Static range sums: n ≤ 200000, q ≤ 200000, print sum a[l..r] per query. **The submission below answers a[r] − a[l] — Wrong Answer on every query that includes index l.** Fix it. ``cpp out << a[r] - a[l]; // prefix built as a[i] = a[i-1] + x, 1-indexed ``

Back to lesson: Practice: Clinic Set 1 — Six Classic Bugs