30:00
Given an integer array nums, return the number of subarrays filled with 0. A subarray is a contiguous non-empty sequence of elements within an array.
1≤nums.length≤1051 \leq \text{nums.length} \leq 10^51≤nums.length≤105
−109≤nums[i]≤109-10^9 \leq \text{nums[i]} \leq 10^9−109≤nums[i]≤109
Here the answer fits in a 32-bit int (LeetCode returns a 64-bit long).
Run code to see results.
Count subarrays made only of 0s in 8 elements. Every such subarray ends at some 0.
nums · bars = zero-filled subarrays ending at i
0
1
2
3
4
5
6
7
total
Given an integer array nums, count the contiguous subarrays whose elements are all 0.