Skip to main content

Simulation II: The Vanishing Sums

Challenge on lesson: Simulation II — The Vanishing Sums

CHALLENGE
Difficulty: advanced+25 XP

**Task.** An array of n integers. Count the non-empty contiguous subarrays whose elements sum to exactly 0. **Constraints:** 1 ≤ n ≤ 200000; −5 ≤ a_i ≤ 5 (the small value range is a deliberate part of the puzzle). The answer can exceed 32-bit. **No topic hints. Run the pipeline.**

Back to lesson: Simulation II — The Vanishing Sums