simple and easy Python solution || O(n) || O(1)
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n\n# Complexity\n- Time complexi
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n\n# Complexity\n- Time complexity: O(n)\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```python3 []\nclass Solution:\n    def minAddToMakeValid(self, s: str) -> int:\n        count, ans = 0, 0\n\n        for ch in s:\n            if ch ==\'(\': count += 1\n            elif count: count -= 1\n            else: ans += 1\n        return ans + count\n```
['String', 'Stack', 'Greedy', 'Python', 'Python3']