Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def first_uniq_char(s):
- idx_list = []
- char_set = set()
- char_dup_set = set()
- for char in s:
- if char in char_set:
- char_set.remove(char)
- char_dup_set.add(char)
- elif char not in char_dup_set:
- char_set.add(char)
- for i in range(len(s)):
- if s[i] in char_set:
- return i
- return
- # print(first_uniq_char("leetcode"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement