You are viewing a single comment's thread. Return to all comments →
solve it by using dict add the values and just call the value whose count is one thats the captain room
k = int(input()) rooms = list(map(int,input().split()))
dict1 = {}
for i in rooms: dict1[i]= dict1.get(i,0)+ 1
for keys,values in dict1.items(): if values == 1: print(keys)
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 →
solve it by using dict add the values and just call the value whose count is one thats the captain room
k = int(input()) rooms = list(map(int,input().split()))
dict1 = {}
for i in rooms: dict1[i]= dict1.get(i,0)+ 1
for keys,values in dict1.items(): if values == 1: print(keys)