leetcode

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

commit 5f4b0531828ed02edd6c1d8a1e3f5141fad84126
parent 01903c0ca25df04b312d414ea722d2f78d84ddfd
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Wed, 10 Jul 2024 15:33:08 +0200

Daily Problem

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

diff --git a/Problems/1598.cpp b/Problems/1598.cpp @@ -0,0 +1,16 @@ +class Solution { + public: + int minOperations(const vector<string> &logs) const { + int res = 0; + + for (const auto &log : logs) { + if (log == "./") continue; + if (log == "../") + res -= res != 0; + else + res++; + } + + return res; + } +}; diff --git a/README.md b/README.md @@ -890,6 +890,7 @@ for solving problems. | 1584 | Medium | [Min Cost to Connect All Points](Problems/1584.cpp) | | 1587 | Easy | [Bank Account Summary II](Problems/1587.cpp) | | 1593 | Medium | [Split a String Into the Max Number of Unique Substrings](Problems/1593.cpp) | +| 1598 | Easy | [Crawler Log Folder](Problems/1598.cpp) | | 1600 | Medium | [Throne Inheritance](Problems/1600.cpp) | | 1601 | Hard | [Maximum Number of Achievable Transfer Requests](Problems/1601.cpp) | | 1603 | Easy | [Design Parking System](Problems/1603.cpp) |