Check Subset

Sort by

recency

|

905 Discussions

|

  • + 0 comments

    Solution without using .issubset()

    case = int(input())
    
    for i in range(case):
        numA = int(input())
        setA = set(list(map(int, input().split())))
        
        numB = int(input())
        setB = set(list(map(int, input().split())))
        
        print(len(setA - setB)==0)
            
    
  • + 0 comments
    t = int(input())
    
    for i in range(t):
        nA = input()
        setA = set(input().split())
    
        nB = input()
        setB = set(input().split())
        
        print(setA.issubset(setB))
    
  • + 0 comments

    Here's my code:

    for _ in range(int(input())):
        al = int(input())
        a = set(list(map(int, input().split()))[:al])
        bl = int(input())
        b = set(list(map(int, input().split()))[:bl])
        print(a.issubset(b))
    
  • + 0 comments
    print(b_set.intersection(a_set)==a_set)
    
  • + 0 comments

    T = int(input()) for i in range(T): A = int(input()) A_el = set(map(int, input().split())) B = int(input()) B_el = set(map(int, input().split())) print(A_el.difference(B_el) == set())