Simple java using Stack
\n# Code\n\nclass Solution {\n    public int minAddToMakeValid(String s) {\n        Stack<Character> st= new Stack<Character>();\n        char ch[]= s.toCharArr
\n# Code\n```\nclass Solution {\n    public int minAddToMakeValid(String s) {\n        Stack<Character> st= new Stack<Character>();\n        char ch[]= s.toCharArray();\n        int c=0;\n        for(int i=0;i< ch.length;i++)\n        {\n            if(ch[i]==\'(\')\n            {\n                st.push(ch[i]);\n            }\n            else\n            {\n                if(!st.isEmpty())\n                {\n                    st.pop();\n                }\n                else\n                c++;\n            }\n           }\n            c+=st.size();\n            return(c);\n        \n    }\n}\n```
['Java']