As reported: PayPal SE3, role specialisation round (2025): one DSA question — remove adjacent duplicates in a string.
Given a string s of lowercase letters, a duplicate removal deletes two adjacent equal letters. Repeat removals until none is possible and return the final string (it is unique).
This is LeetCode 1047 — Remove All Adjacent Duplicates In String.
Example 1
s = "abbaca" -> "ca" (remove "bb" -> "aaca", then "aa" -> "ca")
Example 2
s = "azxxzy" -> "ay"
Constraints: 1 ≤ s.length ≤ 10^5; lowercase English letters.
Code runner format: one line, s as a JSON string. Implement removeDuplicates(s); the harness prints the result.