No Stack | No Hashmap | Two pass solution | Python
\nclass Solution(object):\n    def minRemoveToMakeValid(self, s):   \n        out = []\n        left, right = 0,0\n        include = [True] * len(s)\n        fo
```\nclass Solution(object):\n    def minRemoveToMakeValid(self, s):   \n        out = []\n        left, right = 0,0\n        include = [True] * len(s)\n        for i in range(len(s)):\n            if s[i] ==\'(\':\n                left = left + 1\n            elif s[i] ==\')\':\n                right = right + 1\n                \n            if(right>left):\n                left,right = 0,0\n                include[i] = False\n        \n        left, right = 0,0\n        for i in range(len(s)-1,-1,-1):\n            if s[i] ==\'(\':\n                left = left + 1\n            elif s[i] ==\')\':\n                right = right + 1\n                \n            if(left>right):\n                left,right = 0,0\n                include[i] = False\n                 \n            if include[i]==True:\n                out.append(s[i])\n       \n\t   \n        return reversed(out)\n```
[]