Start from the end of both strings and walk backward. When you hit a '#', count it. When you hit a letter and your backspace count is positive, skip that letter and decrement the count.
Once you've skipped all backspaced characters in both strings, compare the current characters. If they don't match, return false. If one string runs out before the other, return false.
This reverse traversal works because backspaces only affect characters before them. By going right to left, you know exactly how many characters to skip before the next valid comparison.