Backspace String Compare
Problem statement
You are given two strings s1 and s2 containing lowercase English letters and # characters. A # acts as a backspace and removes the preceding remaining character. A backspace applied to an empty string has no effect.
Process both strings and return 1 if their final contents are equal; otherwise return 0.
Function
compareStrings(s1: String, s2: String) → intExamples
Example 1
s1 = "axx#b#b#c"s2 = "axbdf#c#c"return = 0After applying backspaces, axx#b#b#c becomes axc, while axbdf#c#c becomes axbdc. The final strings differ, so the answer is 0.
Constraints
1 <= s1.length <= 2 * 10^51 <= s2.length <= 2 * 10^5- Both strings contain only lowercase English letters and
#.