You are viewing a single comment's thread. Return to all comments →
This is the most efficient basic solution.
M_size, M_set = input(), set(map(int, input().split(' ')))
N_size, N_set = input(), set(map(int, input().split(' ')))
S = sorted(list(M_set.symmetric_difference(N_set)))
[print(i) for i in S]
Using list comprehension in the end will increase performance
Seems like cookies are disabled on this browser, please enable them to open this website
Symmetric Difference
You are viewing a single comment's thread. Return to all comments →
This is the most efficient basic solution.
M_size, M_set = input(), set(map(int, input().split(' ')))
N_size, N_set = input(), set(map(int, input().split(' ')))
S = sorted(list(M_set.symmetric_difference(N_set)))
[print(i) for i in S]
Using list comprehension in the end will increase performance