-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_subset.py
More file actions
19 lines (16 loc) · 901 Bytes
/
check_subset.py
File metadata and controls
19 lines (16 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Check Subset Challenge Solution
# Problem Link: https://www.hackerrank.com/challenges/py-check-subset/problem
# Author: Audity Ghosh
# Date: 1 January 2025
# Description:
# Given two sets, we need to check whether the first set is a subset of the second set.
# The task is to print True if the first set is a subset of the second, and False otherwise.
# Read input from STDIN
t = int(input()) # Read the number of test cases
for i in range(t):
n = int(input()) # Read the number of elements in the first set
s = set(map(int, input().split())) # Read the elements of the first set
m = int(input()) # Read the number of elements in the second set
r = set(map(int, input().split())) # Read the elements of the second set
# Check if the first set is a subset of the second set
print(s.issubset(r)) # Output True if s is a subset of r, otherwise False