C++ || simple stack solution || faster than 100%
\nclass Solution {\npublic:\n    int minAddToMakeValid(string s) {\n        int ans = s.length();\n        stack<char> st;\n        for(int i=0;i<s.length();i++
```\nclass Solution {\npublic:\n    int minAddToMakeValid(string s) {\n        int ans = s.length();\n        stack<char> st;\n        for(int i=0;i<s.length();i++)\n        {\n            if(s[i]==\')\')\n            {\n                if(!st.empty() && st.top()==\'(\')\n                {\n                    st.pop();\n                    ans-=2;\n                }\n            }\n            else\n                st.push(s[i]);\n        }\n        return ans;\n    }\n};\n```
['Stack']