Skip to content

Practice Number of Zero-Filled Subarrays

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2348
LeetCode Problem

Number of Zero-Filled Subarrays

Problem Statement

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.

Source: Number of Zero-Filled Subarrays on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [1,3,0,0,2,0,0,4]
Output
6

# Example 2

Input
nums = [0,0,0,2,0,0]
Output
9

# Example 3

Input
nums = [2,10,2019]
Output
0

Constraints

1 <= nums.length <= 10^5
-10^9 <= nums[i] <= 10^9

Related LeetCode Problems

Practice more problems similar to Number of Zero-Filled Subarrays.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.