The problem. Given an array arr of integers, return how many subarrays (runs of consecutive elements) add up to 0. Overlapping subarrays count separately.
arr = [15, -2, 2, -8, 1, 7, 10, 23] -> 3
arr = [0, 0, 5, 5, 0, 0] -> 6 ([0], [0], [0, 0], and the same three on the right)
arr = [1, 2, 3] -> 0Free account
Sign up to read the rest of this lesson: 7 more sections, 2 drawings, a dry-run simulator and code in JavaScript, Python, Java and C++.
Still to come