Remove all Adjacent Duplicates from a String
In this lesson, we'll learn how to remove all adjacent duplicates from a string using recursion.
We'll cover the following...
We'll cover the following...
What does “Removing Adjacent Duplicates from a String” Mean?
This means that we’ll remove all extra instances of a character when multiple instances are found together. In other words, only one instance should remain after this process.
Lower and upper case letters are considered different characters. Example: string
Hhelodoesn’t contain any duplicates.
Repeated occurrences of the same letter within a string are allowed as long as they are not next to each other. Example: string hele has no adjacent duplicates.
Implementation
Explanation
To remove duplicates, we reduce the length of the string with each recursive call. If the current ...