c++ solution || faster than 98% || using stack
\n string minRemoveToMakeValid(string s) \n    {\n        stack<int >st;   // stack to store the index to each paranthesis\n        for(int i=0;i<s.size();i++)\
```\n string minRemoveToMakeValid(string s) \n    {\n        stack<int >st;   // stack to store the index to each paranthesis\n        for(int i=0;i<s.size();i++)\n        {\n            if(s[i]==\'(\')\n            {\n                st.push(i);\n            }\n            else if(s[i]==\')\')\n            {\n                if(!st.empty())\n                    st.pop();\n                else\n                    s[i]=\'@\';\n            }\n        }\n        while(!st.empty())   \n        {\n            int temp=st.top(); st.pop();\n            s[temp]=\'@\';    // updating the unbalanced paranthesis with \'@\'\n        }\n         s.erase(remove(s.begin(),s.end(),\'@\'),s.end()); // removing all occurence of \'@\'\n        return s;\n    }\n```
[]