Remove Consecutive Duplicates Problem Statement
Given a string str
of size N
, your task is to recursively remove consecutive duplicates from this string.
Input:
T (number of test cases)
N (length of the string for each test case)
str (the string of size N for each test case)
Output:
For each test case, output the modified string with no consecutive duplicates, each result on a new line.
Example:
Input:
1
7
aazbbby
Output:
azby
Constraints:
1 ≤ T ≤ 5
1 ≤ N ≤ 1000
- The string contains only lowercase English letters.
Note:
You do not need to print anything, it has already been taken care of. Just implement the given function.

AnswerBot
4mo
Recursively remove consecutive duplicates from a given string.
Use recursion to check for consecutive duplicates in the string.
If current character is same as next character, skip the next character.
Re...read more
Help your peers!
Add answer anonymously...
Walmart Software Developer interview questions & answers
A Software Developer was asked Q. How many languages do you know?
A Software Developer was asked Q. What are your strengths?
A Software Developer was asked Q. Can you explain Source Code Control (SCC)?
Popular interview questions of Software Developer
A Software Developer was asked 1mo agoQ1. Tell me about yourself.
A Software Developer was asked Q2. How many languages do you know?
A Software Developer was asked Q3. What are your strengths?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

