First Unique Character in a String

Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1.

Constraints

  • 1 <= s.length <= 10^5
  • s consists of only lowercase English letters.
Saving… · 2 lines
class Solution:
def findFirstUniqueCharacter(self, s: str) -> int:
Console

Click Run to execute sample tests.