Python classic valid paranthesis solution
\nclass Solution:\n    def minAddToMakeValid(self, S):\n        r, l = 0, []\n        for s in S:\n            if s == "(":\n                l.append(s)\n      
```\nclass Solution:\n    def minAddToMakeValid(self, S):\n        r, l = 0, []\n        for s in S:\n            if s == "(":\n                l.append(s)\n            elif l:\n                l.pop()\n            else:\n                r += 1 \n        return r + len(l)\n```\nor for fun =>\n```\nclass Solution:\n    def minAddToMakeValid(self, S):\n        l = r = 0\n        for s in S: \n            l, r = (l + 1, r) if s == "(" else (l - 1, r) if l else (l, r + 1)\n        return l + r\n```
[]