Question 48 (Java)

Given a string, complete the given function to recursively remove the adjacent duplicate characters and return the resultant string. If there are no characters left in the resultant string, return “-1” (without quotes).

Sample Test Cases

Sample Input: ABCCBCBA

Output: ACBA

Explanation: (ABCCBCBA –> ABBCBA –> ACBA)

Sample Input: AA

Sample Output: -1

[advanced_iframe securitykey=”undefined” src=”https://ide.kodnest.com/?tgp0″ width=”100%” height=”600″]

Ask Us How You Can Get Your First Dream Job 😉

Fill in the form below to book a 30 min no-obligation consulting session.