O(N) solution using stack|beats 100% | C++
Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(N)\n\n# Code\n\nclass Solution {\npublic:\n    string removeOuterParentheses(string s) {\n\n     
# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(N)\n\n# Code\n```\nclass Solution {\npublic:\n    string removeOuterParentheses(string s) {\n\n        stack<char> st;\n        string ans="";\n\n        for(auto c: s){\n\n            if(!st.empty()) ans+=c;\n            if(c==\'(\') st.push(c);\n            else {\n                st.pop();\n                 if(st.empty()) ans.pop_back();\n            }\n           \n        }\n\n        return ans;\n        \n    }\n};\n```
['C++']