SOLUTION INFO
C++ · main.cpp
class Solution {
public:
int maxDepth(string s) {
int ans = 0, top = 0;
for(const char &ch: s) {
if(ch == '(') ans = max(ans, ++top);
else if(ch == ')') -- top;
}
return ans;
}
};
SOLUTION DESCRIPTION
풀이 설명
등록된 풀이 설명이 없습니다.