Skip to content

Commit 3b14870

Browse files
Merge pull request #2695 from leahjia/2348-number-of-zero-filled-subarray
Created 2348-number-of-zero-filled-subarrays.java
2 parents dc6b267 + f96d09f commit 3b14870

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public long zeroFilledSubarray(int[] nums) {
3+
long res = 0;
4+
long count = 0;
5+
for (int i : nums) {
6+
if (i != 0) count = 0;
7+
else count++;
8+
res += count;
9+
}
10+
return res;
11+
}
12+
}

0 commit comments

Comments
 (0)