leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

commit 5c3b5ef77af21a5637ebd6aa2d2997dc72ebca24
parent 21e4ac374793d462a54ff7ee42a7d784f6d53476
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Tue, 21 Mar 2023 12:13:14 +0100

Daily Problem

Diffstat:
AProblems/2348.cpp | 13+++++++++++++
MREADME.md | 1+
2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/Problems/2348.cpp b/Problems/2348.cpp @@ -0,0 +1,13 @@ +class Solution { +public: + long long zeroFilledSubarray(vector<int> &nums) { + long long res = 0, count = 0; + for (int crnt : nums) { + if (!crnt) + res += ++count; + else + count = 0; + } + return res; + } +}; diff --git a/README.md b/README.md @@ -475,6 +475,7 @@ for solving problems. | 2326 | Medium | [Spiral Matrix IV](Problems/2326.cpp) | | 2331 | Easy | [Evaluate Boolean Binary Tree](Problems/2331.cpp) | | 2343 | Medium | [Query Kth Smallest Trimmed Number](Problems/2343.cpp) | +| 2348 | Medium | [Number of Zero-Filled Subarrays](Problems/2348.cpp) | | 2359 | Medium | [Find Closest Node to Given Two Nodes](Problems/2359.cpp) | | 2368 | Medium | [Reachable Nodes With Restrictions](Problems/2368.cpp) | | 2374 | Medium | [Node With Highest Edge Score](Problems/2374.cpp) |