Symmetric Difference

Sort by

recency

|

1215 Discussions

|

  • + 0 comments
    m ,set_m, n, set_n = input(), set(map(int, input().split())), input(), set(map(int, input().split()))
    [print(x) for x in sorted(set_m.symmetric_difference(set_n))]
    
  • + 0 comments

    M = int(input()) a = set(map(int, input().split()))

    N = int(input()) b = set(map(int, input().split()))

    value = a.difference(b) value.update(b.difference(a))

    for i in sorted(value): print(i)

  • + 0 comments
    M = int(input())
    M_values = set(map(int, input().split()))
    
    N = int(input())
    N_values = set(map(int, input().split()))
    
    combined_diff = sorted(M_values.difference(N_values).union(N_values.difference(M_values)))
    
    for v in combined_diff:
        print(v)
    
  • + 0 comments
    M = int(input())
    a = set(map(int, input().split()))
    N = int(input())
    b = set(map(int, input().split()))
    
    sorted = sorted(a ^ b)
    
    for i in sorted:
        print(i)
    
  • + 0 comments

    M = input() a = input() N = input() b = input()

    Mlis = set(map(int, a.split())) Nlis = set(map(int, b.split()))

    a1 = Mlis.difference(Nlis) b1 = Nlis.difference(Mlis)

    res = sorted((a1.union(b1)))

    res = sorted(Nlis.symmetric_difference(Mlis))

    for i in res: print(i)