Skip to content

Instantly share code, notes, and snippets.

@SingAvi
Created February 25, 2020 16:13
Show Gist options
  • Save SingAvi/94e02e9253c67d8dc25fe771af7d4b44 to your computer and use it in GitHub Desktop.
Save SingAvi/94e02e9253c67d8dc25fe771af7d4b44 to your computer and use it in GitHub Desktop.
First Non Repeating Character
def firstNotRepeatingCharacter(s):
charArray = []
charCount = {}
for i in s:
if i in charCount:
charCount[i] +=1
else:
charCount[i] = 1
charArray.append(i)
for j in charArray:
if charCount[j] == 1 :
return j
return "-1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment