Skip to content

Instantly share code, notes, and snippets.

@hrubantjakub1
Last active April 21, 2017 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrubantjakub1/ad066e3e6007b6c719eb9f7cd0ad3803 to your computer and use it in GitHub Desktop.
Save hrubantjakub1/ad066e3e6007b6c719eb9f7cd0ad3803 to your computer and use it in GitHub Desktop.
my solution for codility task
// find odd element in array
def solution(A):
accessed = [False] * len(A)
randit = len(A)
for a in range(len(A)):
if accessed[a] == False:
for b in range(len(A)):
if a == b:
continue
if accessed[b] == False:
if A[a] == A[b]:
accessed[a] = True
accessed[b] = True
if(accessed[a] == False):
return A[a]
B = [6,2,9,2,3,6,7,3,1,7,9,1,5]
print(solution(B))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment