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.
- Prepare
- Python
- Sets
- The Captain's Room
- Discussions
The Captain's Room
The Captain's Room
Sort by
recency
|
1544 Discussions
|
Please Login in order to post a comment
not sure what is trrying to be taught about sets here... with counter or dict/hashmap it's simple:
Hey, I hope it will help. My code pass all test cases, and I think it's not hard to understand the logic behind :
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())
i = int(input())
list_1 = list(map(int,input().split()))
list_1.sort()
x = 0
while x < len(list_1) - 1:
else: