leetcode

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

commit 9e42f609f804bb22d3929b5f7f4622b60f1ca6da
parent 6b6c1a5c2cb2002512755f718ce16e9cdc92dd58
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Mon,  9 Sep 2024 21:19:34 +0200

1 Random Problem

Diffstat:
AProblems/2526.cpp | 16++++++++++++++++
MREADME.md | 1+
2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/Problems/2526.cpp b/Problems/2526.cpp @@ -0,0 +1,16 @@ +class DataStream { + const int value; + const int k; + int cnt = 0; + + public: + DataStream(int value, int k) : value(value), k(k) {} + bool consec(int num) { + if (num == value) + cnt++; + else + cnt = 0; + + return cnt >= k; + } +}; diff --git a/README.md b/README.md @@ -1223,6 +1223,7 @@ for solving problems. | 2497 | Medium | [Maximum Star Sum of a Graph](Problems/2497.cpp) | | 2498 | Medium | [Frog Jump II](Problems/2498.cpp) | | 2517 | Medium | [Maximum Tastiness of Candy Basket](Problems/2517.cpp) | +| 2526 | Medium | [Find Consecutive Integers from a Data Stream](Problems/2526.cpp) | | 2527 | Medium | [Find Xor-Beauty of Array](Problems/2527.cpp) | | 2536 | Medium | [Increment Submatrices by One](Problems/2536.cpp) | | 2537 | Medium | [Count the Number of Good Subarrays](Problems/2537.cpp) |