Back to course home
0% completed
Vote For New Content
Problem 1: First Non-repeating Character (easy)
Problem Statement
Given a string, identify the position of the first character that appears only once in the string. If no such character exists, return -1.
Examples
-
Example 1:
- Input: "apple"
- Expected Output: 0
- Justification: The first character 'a' appears only once in the string and is the first character.
-
Example 2:
- Input: "abcab"
- Expected Output: 2
- Justification: The first character that appears only once is 'c' and its position is 2.
-
Example 3:
- Input: "abab"
- Expected Output: -1
- Justification: There is no character in the string that appears only once.
Constraints:
- 1 <= s.length <= 10<sup>5</sup>
s
consists of only lowercase English letters.
Try it yourself
Try solving this question here:
Python3
Python3
. . . .
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible