Skip to main content

Practice · 9 of 9

Mixed C2

CHALLENGE
Difficulty: advanced+25 XP

**Bài toán.** Given n integers (possibly negative) and a target K, count subarrays (contiguous) whose sum is exactly K. **Constraints:** 1 ≤ n ≤ 200000; −100 ≤ a[i] ≤ 100; −10^9 ≤ K ≤ 10^9. **Input:** line 1: n and K; line 2: n values. **Output:** one integer (fits in 64 bits).

Back to lesson: Practice: Mixed Sets A/B/C — Topics Hidden