Practice · 4 of 8
Count Target Pairs
CHALLENGE
Difficulty: advanced+25 XP
**Tình huống.** Given n ≤ 200000 integers a[i] and a target x, count the pairs i < j with a[i] + a[j] = x. **Thuật toán nào phù hợp nhất? Chương trình chỉ cần in ra chữ cái.** **A)** Nested loops over all pairs **B)** Sort, then two pointers from both ends **C)** Segment tree with lazy propagation **D)** Binary search on the answer
Press Submit to check your solution.
Back to lesson: Practice: Recognition Drill Set 1