• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
September 15, 2023 |700 Views
SDE Sheet - Find first repeated character
  Share   Like
Description
Discussion

This video is part of the Strings section in the GFG SDE Sheet.

In this video, we are given n a string, Our task is to find the first repeated character in it. We need to find the character that occurs more than once and whose index of the second occurrence is smallest.

Example:

Input: ch = “geeksforgeeks” 
Output: e 
e is the first element that repeats

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:-

Article: https://www.geeksforgeeks.org/find-the-first-repeated-character-in-a-string/
Problem: https://practice.geeksforgeeks.org/problems/find-first-repeated-character/0
SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/
 

Read More