2432. Number of Zero-Filled Subarrays
My accepted Python solution to LeetCode problem 2432, Number of Zero-Filled Subarrays, running in 28ms.
- Difficulty: Medium
- Python
- Runtime 28ms
- Memory 28.7MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 28ms, memory 28.7MB, accepted 2025-12-29.
class Solution:
def zeroFilledSubarray(self, nums: List[int]) -> int:
result = 0
count = 0
for num in nums:
if num == 0:
count += 1
result += count
else:
count = 0
return result