leetcode

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

1614.cpp (292B)


0 class Solution {
1 public:
2 int maxDepth(const string &s) const {
3 int res = 0, cnt = 0;
5 for (const char c : s) {
6 if (c == '(')
7 cnt++;
8 else if (c == ')')
9 res = max(res, cnt--);
10 }
12 return res;
13 }
14 };