-
Notifications
You must be signed in to change notification settings - Fork 75
Closed
Description
#!/bin/python3
#Given an array of integers, where all elements but one occur twice, find the unique element.
import math
import os
import random
import re
import sys
def lonelyinteger(a):
# Write your code here
length=len(a)
res=a[0]
for i in range(1,length):
res=res^a[i]
return(res)
if name == 'main':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
n = int(input().strip())
a = list(map(int, input().rstrip().split()))
result = lonelyinteger(a)
fptr.write(str(result) + '\n')
fptr.close()
Metadata
Metadata
Assignees
Labels
No labels