[python] O(1) space using generator and compare from backward
Make generators to yield the final chars from back to front. Compare the chars one-by-one.\n\n    def backspaceCompare(self, S, T):\n        """\n        :type 
Make generators to yield the final chars from back to front. Compare the chars one-by-one.\n```\n    def backspaceCompare(self, S, T):\n        """\n        :type S: str\n        :type T: str\n        :rtype: bool\n        """\n\n        def next_char_gen(s):\n            bs = 0\n            for c in s[::-1]:\n                if c == \'#\':\n                    bs += 1\n                elif bs > 0:\n                    bs -= 1\n                else:\n                    yield c\n\n        S_gen = next_char_gen(S)\n        T_gen = next_char_gen(T)\n\n        for a, b in itertools.zip_longest(S_gen, T_gen):\n            if a != b:\n                return False\n\n        return True\n```
[]