Facebook followup: without using stack
\n    # without stack\n        s = list(s)\n        count = 0\n        for i, char in enumerate(s):\n            if char == \'(\':\n                count += 1\n
```\n    # without stack\n        s = list(s)\n        count = 0\n        for i, char in enumerate(s):\n            if char == \'(\':\n                count += 1\n            elif char == \')\':\n                if count: count -= 1\n                else: s[i] = \'\'\n        if count:\n            for i in range(len(s)-1, -1, -1):\n                if count and s[i] == \'(\':\n                    s[i] = \'\'\n                    count -= 1\n                if not count: break\n        return \'\'.join(s)\n```
[]