Check Subset

Sort by

recency

|

945 Discussions

|

  • + 0 comments
    for _ in range(int(input())):
        _,A = int(input()) , set(map(int,input().split()))
        _,B = int(input()) , set(map(int,input().split()))
        print(A.issubset(B)) # Alternative : print(A&B == A)
    
  • + 0 comments
    test_cases=int(input())
    sets_list=[ [int(input()),set(map(int,input().split())),int(input()),set(map(int,input().split()))] for i in range(test_cases)]
    for sets in sets_list:
        print(sets[1].intersection(sets[-1])==sets[1])
    
  • + 0 comments
    T= int(input())
    for inputs in range(T):
        no_of_elements_in_A = int(input())
        A = set(input().split())
        no_of_elements_in_B = int(input())
        B = set(input().split())
        
        if len(A.difference(B)) == 0:  # or, A.difference(B)==set()
            print("True")
        else:
            print("False")
        
        
        
    
  • + 0 comments

    t=int(input())

    for _ in range(t): n=int(input()) a=set(map(int,input().split())) m=int(input()) b=set(map(int,input().split())) if a.intersection(b) == a: print(True) else: print(False)

  • + 0 comments

    T = int(input())

    for i in range(T):

    a = input()
    set_1 = set(map(int,input().split()))
    b = input()
    set_2 = set(map(int,input().split()))
    c = set_1.difference(set_2)
    if len(c)>0:
        print(False)
    else:
        print(True)