DAYS
HOUR
MINS
SEC
Error
Given a string s, remove all its adjacent duplicate characters recursively.
Example 1:
Input:
S = "geeksforgeek"
Output: "gksforgk"
Explanation:
g(ee)ksforg(ee)k -> gksforgk
Example 2:
Input:
S = "abccbccba"
Output: ""
Explanation:
ab(cc)b(cc)ba->abbba->a(bbb)a->aa->(aa)->""(empty string)
Your Task:
You don't need to read input or print anything. Your task is to complete the function rremove() which takes the string S as input parameter and returns the resultant string.
Note: For some test cases, the resultant string would be an empty string. For that case, the function should return the empty string only.
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(|S|)
Constraints:
1<=|S|<=105
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes