Remove Duplicates

Easy
0/40
20 upvotes
Asked in companies
CIS - Cyber InfrastructureSAP LabsAdobe

Problem statement

Given a string S, remove consecutive duplicates from it recursively.

Detailed explanation ( Input/output format, Notes, Images )
Input Format :
String S
Output Format :
Output string
Constraints :
1 <= |S| <= 10^3
where |S| represents the length of string
Sample Input 1 :
aabccba
Sample Output 1 :
abcba
Sample Input 2 :
xxxyyyzwwzzz
Sample Output 2 :
xyzwz
Approaches (1)
Time Complexity
Space Complexity
Code Solution
(100% EXP penalty)
Remove Duplicates
Full screen
Console