Easy C++ Code, beats 100% time and 90% space complexity, 10 lines code
\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nIterating once and counting all 
\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nIterating once and counting all the lose paranthesis in the string.\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int minAddToMakeValid(string s) {\n        int opening=0,closing=0;\n        std::string::iterator itr=s.begin();\n        while(itr!=s.end())\n        {\n            if(*itr==\'(\'&&closing==0)\n                opening++;\n            else if(*itr==\')\'&&opening!=0)\n                opening--;\n            else if(*itr==\'(\')\n                opening++;\n            else\n                closing++;\n            itr++;\n        }\n        return opening+closing;\n    }\n};\n```
['C++']