We have to take T testcases and then each time loop runs the current instance we take Set A and Set B Size and there elements and check whether they are subset or not using issubset()
Problem:https://www.hackerrank.com/challenges/py-check-subset/problem?isFullScreen=true
Code:
# Enter your code here. Read input from STDIN. Print output to STDOUT
T = int(input())
#Naive Approach
for _ in range(T):
x = int(input())
setA = set(map(int, input().split()))
y = int(input())
setB = set(map(int, input().split()))
print(setA.issubset(setB))
"""
1. Read the number of test cases (T).
This determines how many times we will repeat the subset check process.
2. For each test case:
- Read the size of the first set (not strictly needed for logic,
but typically provided in competitive programming input format).
- Read the elements of the first set and convert them into a set.
Using a set removes duplicates and allows efficient subset checking.
- Read the size of the second set (also not strictly needed for logic).
- Read the elements of the second set and convert them into a set.
- Check whether the first set is a subset of the second set.
This means every element in the first set must also exist in the second set.
- Print the result (True or False) for that test case.
3. Repeat the above steps for all test cases.
"""
