Created
November 25, 2014 09:20
-
-
Save mahendrakalkura/3a97e6eef732dd461ba3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from collections import Counter | |
from random import randint | |
def solution(A): | |
unique_integers = [ | |
integer | |
for integer, count in Counter(A).iteritems() | |
if count == 1 | |
] | |
if unique_integers: | |
for integer in A: | |
if integer in unique_integers: | |
return integer | |
return -1 | |
print solution([]) | |
print solution([ | |
randint(1, 1000000000) | |
for _ in xrange(0, 100000) | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment