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.
I tried using set since it is from the sets section. Time is exceeding limit, anyone who can optimize this.
N=int(input())
m=list(map(int, input().split()))
n=set(m)
l=[]
for i in n:
count=0
for j in m:
if i==j:
count +=1
l.append([i,count])
for i in l:
if i[1]==1:
print(i[0])
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 →
I tried using set since it is from the sets section. Time is exceeding limit, anyone who can optimize this. N=int(input()) m=list(map(int, input().split())) n=set(m) l=[] for i in n: count=0 for j in m: if i==j: count +=1 l.append([i,count])
for i in l: if i[1]==1: print(i[0])