💡One Pass | FAANG SDE-1 Interview😯
\nVery Easy Beginner Friendly Solution \uD83D\uDCA1\nDo not use stack to prevent more extra space.\n\n\nPlease do Upvote if it helps :)\n\n\n# Complexity\n- Tim
```\nVery Easy Beginner Friendly Solution \uD83D\uDCA1\nDo not use stack to prevent more extra space.\n\n\nPlease do Upvote if it helps :)\n```\n\n# Complexity\n- Time complexity: O(n) //One pass\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n) //For resultant string\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    string removeOuterParentheses(string s) {\n        string res;\n        int count=0;\n        for(int i=0;i<s.size();i++){\n            if(s[i]==\'(\' && count==0)\n                count++;\n            else if(s[i]==\'(\' && count>=1){\n                res+=s[i];\n                count++;\n            }   \n            else if(s[i]==\')\' && count>1){\n                res+=s[i];\n                count--;\n            }\n            else if(s[i]==\')\' && count==1)\n                count--;\n        }\n        return res;\n    }\n};\n```
['String', 'Stack', 'C++', 'Java', 'Python3']