Easy JAVA Solution  | 100% | O(n) time , O(1)space
Intuition\nat a particular place if we are lacking open brackets that mean we need opening bracket for the current closing bracket to balance and Simply we just
# Intuition\nat a particular place if we are lacking open brackets that mean we need opening bracket for the current closing bracket to balance and Simply we just add the extra open brackets... \nAt last if we are left with some open brackets we directly add the in out moves..\n\n# Complexity\n- Time complexity: O(n) , n=String length\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int minAddToMakeValid(String s) {\n        //counting open brackets\n        int opn=0;\n        //record of extra moves we need\n        int mvs=0;\n        for(char ch : s.toCharArray()){\n            //if ch==\'(\' we add 1 to opn\n            if(ch==\'(\')opn++;\n             //if ch==\')\' we have two options\n            if(ch==\')\'){\n                //if we have enough brackets we decrement from them\n                //else we need an extra bracket\n                if(opn>0)opn--;\n                else mvs++;\n            }\n        }\n        //atlast add all open brackets left\n        if(opn!=0)mvs+=opn;\n        return mvs;\n    }\n}\n```
['String', 'Sliding Window', 'Java']