Java simple solution 100% faster
\nclass Solution {\n    public int minAddToMakeValid(String S) {\n        int openingNeeded = 0;\n        int closingNeeded = 0;\n        \n        for(int i = 
```\nclass Solution {\n    public int minAddToMakeValid(String S) {\n        int openingNeeded = 0;\n        int closingNeeded = 0;\n        \n        for(int i = 0; i < S.length(); i++){\n            if(S.charAt(i) == \'(\'){\n                closingNeeded++;\n            }else{\n                if(closingNeeded == 0){\n                    openingNeeded++;\n                }else{\n                    closingNeeded--;\n                }\n            }\n        }\n        \n        return openingNeeded + closingNeeded;\n    }\n}\n```
['Java']