2 pointer building up from Stack C++ solution
(1) Stack\n\nclass Solution {\npublic:\n    int minAddToMakeValid(string S) {\n        stack<char> stack;\n        \n        for(char s : S){\n            if(s=
(1) Stack\n```\nclass Solution {\npublic:\n    int minAddToMakeValid(string S) {\n        stack<char> stack;\n        \n        for(char s : S){\n            if(s==\'(\')\n                stack.push(s);\n            else{\n                if(!stack.empty() && stack.top()==\'(\')\n                    stack.pop();\n                else\n                    stack.push(s);\n            }\n        }\n        return stack.size();\n    }\n};\n\n```\n(2) 2 pointer\n```\nclass Solution {\npublic:\n    int minAddToMakeValid(string S) {\n        int balanceopen=0, balanceclose=0;\n        \n        for(int i=0; i<S.size(); i++){\n            if(S[i]==\'(\')\n                balanceopen++;\n            else{\n                if(balanceopen>0)\n                    balanceopen--;\n                else\n                    balanceclose++;\n            }\n        }\n        return balanceopen+balanceclose;\n    }\n};\n```
['Two Pointers', 'Stack', 'C', 'C++']