Katkat

Compare Strings With Deletions

OtherBackend Engineer · Technical Screen

Last updated

This question evaluates string processing and algorithmic optimization skills, specifically handling simulated deletions (backspace behavior) and performing comparisons under a strict auxiliary space constraint.

Return whether the two strings are equal after all deletions are applied.

You must implement the comparison without using extra space proportional to the input size. Aim for O(1) auxiliary space.

Example:

Input: s = "ab#c", t = "ad#c"
Output: true
Explanation: Both strings become "ac".
Input: s = "a#c", t = "b"
Output: false
Explanation: The first string becomes "c", while the second becomes "b".