[Java] Simple one pass 100% solution
java\nclass Solution {\n    public int minAddToMakeValid(String s) {\n        int left = 0, right = 0;\n\n        for(int i = 0; i < s.length(); ++i) {\n       
```java\nclass Solution {\n    public int minAddToMakeValid(String s) {\n        int left = 0, right = 0;\n\n        for(int i = 0; i < s.length(); ++i) {\n            if(s.charAt(i) == \'(\')\n                left++;\n            else if(left > 0)\n                left--;\n            else\n                right++;\n        }\n\n        return left + right;\n    }\n}\n```
['Java']