✔️✔️💯Brute Intuitive solution💯✅🔥 with and without stack beast time and Space
\n# Code\njava []\nclass Solution {\n    public int minAddToMakeValid(String s) {\n\n        int requiredAdditions = 0;\n        Stack<Character> st = new Stack
\n# Code\n```java []\nclass Solution {\n    public int minAddToMakeValid(String s) {\n\n        int requiredAdditions = 0;\n        Stack<Character> st = new Stack<>();\n        for (char c : s.toCharArray()) {\n            if (c == \'(\') {\n               st.push(c);\n            } else if(st.isEmpty())\n            {\n                requiredAdditions++;\n            }\n            else{\n                st.pop();\n            }\n        }\n        return requiredAdditions+st.size();\n    }\n}\n```\n```java []\nclass Solution {\n    public int minAddToMakeValid(String s) {\n        int openCount = 0;\n        int closeCount = 0;\n        int requiredAdditions = 0;\n\n        for (char c : s.toCharArray()) {\n            if (c == \'(\') {\n                openCount++;\n            } else {\n                if (closeCount < openCount) {\n                    closeCount++;\n                } else {\n                    requiredAdditions++;\n                }\n            }\n        }\n\n        requiredAdditions += openCount - closeCount;\n        return requiredAdditions;\n    }\n}\n```\n```java []\nclass Solution {\n    public int minAddToMakeValid(String s) {\n        int openCount = 0;\n        int closeCount = 0;\n        int requiredAdditions = 0;\n\n        for (char c : s.toCharArray()) {\n            if (c == \'(\') {\n                openCount++;\n            } else if (openCount > closeCount) {\n                closeCount++; \n            }else {\n                requiredAdditions++;\n            }\n        }\n\n        requiredAdditions += openCount - closeCount;\n        return requiredAdditions;\n    }\n}\n\n```\n\n[1541. Minimum Insertions to Balance a Parentheses String](https://leetcode.com/problems/minimum-insertions-to-balance-a-parentheses-string/solutions/5348641/the-parenthesis-template-question-brute-intuitive-interview/)\n[921. Minimum Add to Make Parentheses Valid](https://leetcode.com/problems/minimum-add-to-make-parentheses-valid/solutions/5348632/brute-intuitive-solution-with-and-without-stack-beast-time-and-space/)\n[20. Valid Parentheses](https://leetcode.com/problems/valid-parentheses/solutions/5159895/brute-intuitive-solution-beats-98/) --> *simple yet tricky*\n[301. Remove Invalid Parentheses](https://leetcode.com/problems/remove-invalid-parentheses/solutions/5305306/have-fun-solving-this-easy-problem/) -> **Important**\n[32. Longest Valid Parentheses](https://leetcode.com/problems/longest-valid-parentheses/solutions/5348623/simple-solution-in-java-must-read/)\n[1614. Maximum Nesting Depth of the Parentheses](https://leetcode.com/problems/maximum-nesting-depth-of-the-parentheses/solutions/5304994/the-parenthesis-problems/)\n[282. Expression Add Operators](https://leetcode.com/problems/expression-add-operators/solutions/5348619/brute-intuitive-recursive-solution-must-read/) --> **Important**\n[2232. Minimize Result by Adding Parentheses to Expression](https://leetcode.com/problems/minimize-result-by-adding-parentheses-to-expression/solutions/5304516/beats-98/)\n[241. Different Ways to Add Parentheses](https://leetcode.com/problems/different-ways-to-add-parentheses/solutions/5304322/java-simple-solution/)\n[856. Score of Parentheses](https://leetcode.com/problems/score-of-parentheses/solutions/5203496/scoreofparentheses/) --> **unique**\n[678. Valid Parenthesis String]()\n[1003. Check If Word Is Valid After Substitutions]()\n[1963. Minimum Number of Swaps to Make the String Balanced]()
['Java']