nikunjsoni

1021

Mar 22nd, 2021
65
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Solution {
  2. public:
  3.     string removeOuterParentheses(string S) {
  4.         string res;
  5.         int count=0;
  6.         for(char c: S){
  7.             if(c == '(' && count++ > 0) res += c;
  8.             if(c == ')' && count-- > 1) res += c;
  9.         }
  10.         return res;
  11.     }
  12. };
RAW Paste Data