• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
June 29, 2024 |510 Views

SDE Sheet - Recursively remove all adjacent duplicates

Description
Discussion

This video is part of the Recursion and Backtracking section under GFG SDE Sheet.

Given a string s, remove all its adjacent duplicate characters recursively. 

Note: For some test cases, the resultant string would be an empty string. In that case, the function should return the empty string only.

Example 1:

Input: S = "geeksforgeek"
Output: "gksforgk"
Explanation: g(ee)ksforg(ee)k -> gksforgk

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-
Problem: https://www.geeksforgeeks.org/problems/recursively-remove-all-adjacent-duplicates0744/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/
Article Link: https://www.geeksforgeeks.org/recursively-remove-adjacent-duplicates-given-string/