Skip to content

Instantly share code, notes, and snippets.

@mahendrakalkura
Created November 25, 2014 09:20
Show Gist options
  • Save mahendrakalkura/3a97e6eef732dd461ba3 to your computer and use it in GitHub Desktop.
Save mahendrakalkura/3a97e6eef732dd461ba3 to your computer and use it in GitHub Desktop.
# -*- 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