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.
for i in set_a:
if i in seen_once:
seen_multiple.add(i)
else:
seen_once.add(i)
unique_elements = seen_once - seen_multiple
for element in unique_elements:
print(element)
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 →
a = int(input())
set_a = list(map(int, input().split()))
seen_once = set()
seen_multiple = set()
for i in set_a: if i in seen_once: seen_multiple.add(i) else: seen_once.add(i) unique_elements = seen_once - seen_multiple for element in unique_elements: print(element)