2348.cpp (289B)
1 class Solution { 2 public: 3 long long zeroFilledSubarray(vector<int> &nums) { 4 long long res = 0, count = 0; 5 for (int crnt : nums) { 6 if (!crnt) 7 res += ++count; 8 else 9 count = 0; 10 } 11 return res; 12 } 13 };