Backspace String Compare

Easy · Stack & Monotonic Stack · about 10 minutes

Asked at Google, Microsoft, Amazon, Meta, Salesforce.

Imagine typing s and t into two blank text boxes, where the character '#' acts as the backspace key (pressing it in an empty box has no effect). Report whether both boxes end up showing the same text.