O(1) Python solution
Same logic with this thread:\n\nkey point is comparing from tail:\n```\ndef backspaceCompare(self, S, T):\n        """\n        :type S: str\n        :type T: s
Same logic with this [thread](https://leetcode.com/problems/backspace-string-compare/discuss/161771/Python-O(1)-Space):\n\nkey point is comparing from tail:\n```\ndef backspaceCompare(self, S, T):\n        """\n        :type S: str\n        :type T: str\n        :rtype: bool\n        """\n        i = len(S) - 1\n        j = len(T) - 1        \n        ci = 0\n        cj = 0\n        \n        while i >= 0 or j >= 0:\n            while i >= 0:\n                if S[i] == "#":\n                    i -= 1\n                    ci +=1\n                elif ci > 0:\n                    i -= 1\n                    ci -= 1\n                else:\n                    break  \n                    \n            while j >= 0:\n                if T[j] == "#":\n                    j -= 1\n                    cj +=1\n                elif cj > 0:\n                    j -= 1\n                    cj -= 1\n                else:\n                    break\n                    \n            if i < 0: return j < 0            \n            if j < 0: return i < 0                \n            if S[i] != T[j]: return False\n            i -= 1\n            j -= 1             \n\n        return True
[]