Tap here to switch tabs
Problem
Submissions

Problem: Backspace String Compare

Backspace String Compare gives two strings typed into an empty editor, where a hash character deletes the previous character. Return whether both strings produce identical final text.

Statement

Given two strings s and t, return true if they produce the same result when typed into an empty text editor, where '#' represents a backspace character. Applying a backspace on an empty editor leaves it unchanged.

Note: Can you solve it in O(n)O(n) time and O(1)O(1) space?

Constraints:

  • 1≤1 \leq s.length, t.length ≤200\leq 200

  • s and t contain only lowercase English letters and '#' characters

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Backspace String Compare

Backspace String Compare gives two strings typed into an empty editor, where a hash character deletes the previous character. Return whether both strings produce identical final text.

Statement

Given two strings s and t, return true if they produce the same result when typed into an empty text editor, where '#' represents a backspace character. Applying a backspace on an empty editor leaves it unchanged.

Note: Can you solve it in O(n)O(n) time and O(1)O(1) space?

Constraints:

  • 1≤1 \leq s.length, t.length ≤200\leq 200

  • s and t contain only lowercase English letters and '#' characters