C++ O(n) explanation
\nThe way to tackle this question is to keep a varial lets say open that increments for every opening braces and decrements for every closing\nbraces.\nWe will 
```\nThe way to tackle this question is to keep a varial lets say open that increments for every opening braces and decrements for every closing\nbraces.\nWe will first be considering mismatches of the closing brackets \')\'.\nif open is equal to 0 and a closing bracket occurs ignore it.\ns = "lee(t(c)o)de)"    open=0\n         ^\n         |\n         i\nopen = 1\ns = "lee(t(c)o)de)"\n          ^\n          |\n          i \nopen = 2\n\ns = "lee(t(c)o)de)"\n            ^\n            |\n            i\nopen is not 0 \nopen = 1\n\ns = "lee(t(c)o)de)"\n              ^\n              |\n              i \nopen not 0 \nopen = 0\n\ns = "lee(t(c)o)de)"\n                 ^\n                 |\n                 i \nopen is 0 so ignore\n\nBut what if there are more opening braces than closing to handle this we first make sure the closing braces are taken care of\n then with the same open we start from behind and check if open is > 0 if so we skip it and decremnt open.\n\n\n     string minRemoveToMakeValid(string s) {\n        int open=0;\n        string t;\n        for(int i=0;i<s.size();i++)\n        {\n            if(s[i]==\'(\')open++;\n            else if(s[i]==\')\')\n            {\n                if(open==0)continue;\n                open--;\n            }\n            t+=s[i];\n        }\n        string ans;\n        for(int i=t.size()-1;i>=0;i--)\n        {\n            if(t[i]==\'(\' && open>0)\n            {\n                open--;\n                continue;\n            }\n            ans+=t[i];\n        }\n        reverse(ans.begin(),ans.end());\n        return ans;\n    } \n\n```
['C', 'C++']