Skip to main content

Practice · 2 of 5

XOR Over a Range

CHALLENGE
Difficulty: advanced+25 XP

**Bài toán.** T ≤ 10^4 queries of n ≤ 10^9: print the XOR of all integers 1..n. **Constraints:** 1 ≤ T ≤ 10^4; 1 ≤ n ≤ 10^9. The pattern repeats with period 4 — a loop to n will time out.

Back to lesson: Practice: Attack Pattern Drills