Union and Intersection of Two Sorted Arrays || Python

 

In this we are going to see a program on how to find Union and Intersection of Two Sorted Arrays in Python Programming Language.


def union(a, b):
    return list(set(a) | set(b))

def intersection(a, b):
    return list(set(a) & set(b))

print(union([1, 2, 3, 4, 5, 9], [2, 3, 4, 5, 6, 8]))
print(intersection([1, 2, 3, 4, 5, 9, 7], [2, 3, 4, 5, 6, 8, 7]))

# Coded By DHIRAJ SHELKE

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post