leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE | |
commit | dc65284cdcd3a2cb4f4d9a79c003cd55c517018b |
parent | 93bc551ae7eaa6121ba66930992060158f16520c |
author | Dimitrije Dobrota <mail@dimitrijedobrota.com> |
date | Thu, 4 Apr 2024 11:37:46 +0200 |
Daily Problem
Diffstat:A | Problems/1614.cpp | | | +++++++++++++++ |
M | README.md | | | + |
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/Problems/1614.cpp b/Problems/1614.cpp
@@ -0,0 +1,15 @@
class Solution {
public:
int maxDepth(const string &s) const {
int res = 0, cnt = 0;
for (const char c : s) {
if (c == '(')
cnt++;
else if (c == ')')
res = max(res, cnt--);
}
return res;
}
};
diff --git a/README.md b/README.md
@@ -847,6 +847,7 @@ for solving problems.
| 1605 | Medium | [Find Valid Matrix Given Row and Column Sums](Problems/1605.cpp) |
| 1609 | Medium | [Even Odd Tree](Problems/1609.cpp) |
| 1611 | Hard | [Minimum One Bit Operations to Make Integers Zero](Problems/1611.cpp) |
| 1614 | Easy | [Maximum Nesting Depth of the Parentheses](Problems/1614.cpp) |
| 1615 | Medium | [Maximal Network Rank](Problems/1615.cpp) |
| 1624 | Easy | [Largest Substring Between Two Equal Characters](Problems/1624.cpp) |
| 1625 | Medium | [Lexicographically Smallest String After Applying Operations](Problems/1625.cpp) |