Backspace String Compare LeetCode solution in Python
1class Solution:2def backspaceCompare(self, s: str, t: str) -> bool:3def backwardResult(string):4debt = 056for c in reversed(string):7if c == "#":8debt += 1910elif debt > 0:11debt -= 11213else:14yield c1516return all(17a == b for (a, b) in zip_longest(backwardResult(s), backwardResult(t))18)