We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
a = int(input())
datas = list(map(int,input().split()))
seta = set()
setb = set()
for each in datas:
if each not in seta:
seta.add(each)
setb.add(each)
else:
#print(each)
setb.discard(each)
print(setb.pop())
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Captain's Room
You are viewing a single comment's thread. Return to all comments →
using two sets
a = int(input()) datas = list(map(int,input().split())) seta = set() setb = set() for each in datas: if each not in seta: seta.add(each) setb.add(each) else: #print(each) setb.discard(each)
print(setb.pop())