Welcome to the daily solving of our PROBLEM OF THE DAY with Karan Mashru We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of String but also build up problem-solving skills.
Given a string str without spaces, the task is to remove all duplicate characters from it, keeping only the first occurrence.
Note: The original order of characters must be kept the same.
Examples :
Input: str = "zvvo"
Output: "zvo"
Explanation: Only keep the first occurrence
Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/remove-duplicates3034/1