SHARE
TWEET

Untitled

a guest Jul 20th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def first_uniq_char(s):
  2.     idx_list = []
  3.     char_set = set()
  4.     char_dup_set = set()
  5.     for char in s:
  6.         if char in char_set:
  7.             char_set.remove(char)
  8.             char_dup_set.add(char)
  9.         elif char not in char_dup_set:
  10.             char_set.add(char)
  11.  
  12.     for i in range(len(s)):
  13.         if s[i] in char_set:
  14.             return i
  15.     return
  16.  
  17. # print(first_uniq_char("leetcode"))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top