Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- string removeOuterParentheses(string S) {
- string res;
- int count=0;
- for(char c: S){
- if(c == '(' && count++ > 0) res += c;
- if(c == ')' && count-- > 1) res += c;
- }
- return res;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement