Easy understanding solution using Stack and Stringbuilder
```\nclass Solution {\n    public String minRemoveToMakeValid(String s) {\n        Stack st = new Stack<>();\n      StringBuilder ans = new StringBuilder(s);\n 
```\nclass Solution {\n    public String minRemoveToMakeValid(String s) {\n        Stack<Integer> st = new Stack<>();\n      StringBuilder ans = new StringBuilder(s);\n      for(int i = 0; i < s.length(); i ++)\n      {\n        if(s.charAt(i) == \'(\')\n          st.push(i);\n        else if(s.charAt(i) == \')\')\n        {\n          if(st.size() > 0 && s.charAt(st.peek()) == \'(\')\n            st.pop();\n          else\n            st.push(i);\n        }\n      }\n      while(st.size() > 0)\n        ans.deleteCharAt(st.pop());\n      \n      return ans.toString();\n    }\n}
['String', 'Stack', 'Java']