First non-repeating character in a String(Contest)
First non-repeating character in a String easy asked in interviews by 3 companies Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
First non-repeating character in a String easy asked in interviews by 3 companies Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
Given a string s, find the first non-repeating character in the string and return its index. If it does not exist, return -1. Input First line of the input contains the string s.
Constraints 1<= s. length <= 100000 Output Print the index of the first non- repeating character in a string Example Input s = "newtonschool"
Output 1
Explanation "e" is the first non- repeating character in a string
link: