Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Process both strings from the end. For each string, skip characters when encountering backspaces by counting consecutive # symbols. Compare the next valid characters from both strings. If they differ at any point, the strings are not equal.
Processing from the end allows us to handle backspaces without extra space. Each # cancels the preceding character, and counting skips handles consecutive backspaces correctly.
Updated Feb 2026