Skip to content

Commit 0191d9d

Browse files
committed
Solution as on 24-07-2022 09:00 pm
1 parent 41ef691 commit 0191d9d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// 2348.✅ Number of Zero-Filled Subarrays
2+
3+
class Solution
4+
{
5+
public:
6+
long long zeroFilledSubarray(vector<int> &nums)
7+
{
8+
long ans = 0;
9+
long count = 0;
10+
11+
for (int i = 0; i < nums.size(); ++i)
12+
{
13+
if (nums[i] == 0)
14+
{
15+
++count;
16+
ans += count;
17+
}
18+
else
19+
count = 0;
20+
}
21+
return ans;
22+
}
23+
};

0 commit comments

Comments
 (0)