Easiest Solution || Beginner Level ||  C++
\n# Code\nC++\nclass Solution {\npublic:\n    int minAddToMakeValid(string s) {\n        int n=s.length();\n        stack<int> st;\n        for(int i=0;i<n;i++)
\n# Code\n```C++\nclass Solution {\npublic:\n    int minAddToMakeValid(string s) {\n        int n=s.length();\n        stack<int> st;\n        for(int i=0;i<n;i++){\n            char c=s[i];\n           if(!st.empty()&&(st.top()==\'(\'&&c==\')\')){\n            st.pop();\n           } else{\n            st.push(c);\n           }\n        }\n        return st.size();\n    }\n};\n```
['C++']