Given a string s, remove all its adjacent duplicate characters recursively.
S = "geeksforgeek"
g(ee)ksforg(ee)k -> gksforgkâ€‹
S = "acaaabbbacdddd"
ac(aaa)(bbb)ac(dddd) -> acac
You don't need to read input or print anything. Your task is to complete the function remove() which takes the string S as input parameter and returns the resultant string.
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(|S|)
We strongly recommend solving this problem on your own before viewing its editorial. Do you still
want to view the editorial?
Login to access your submissions.