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
- Check Subset
- Discussions
Check Subset
Check Subset
Sort by
recency
|
926 Discussions
|
Please Login in order to post a comment
T = int(input()) result = list([]) for i in range(T): n1 = int(input()) A = set(list(map(int, input().split()))[:n1]) n2 = int(input()) B = set(list(map(int, input().split()))[:n2])
for i in result: print(i)
can be done by checking on subset length:
simple logic
t = int(input()) i = 0 while i in range(t):
set_a = int(input()) set_a_list = set(list(input().split())) set_b = int(input()) set_b_list = set(list(input().split())) print(set_a_list.issubset(set_b_list)) i += 1