Union of Two Arrays Problem

Union of Two Arrays Problem — ExecCode School DSA Practice

Solve the Union of Two Arrays problem on ExecCode. Free online school DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given two lists of integers, compute their union. Your task is to solve Union of Two Arrays. Print the unique elements from both lists in sorted order.

Examples

Input 5 3 1 2 3 4 5 1 2 6; Output 1 2 3 4 5 6. Input 3 3 1 2 3 4 5 6; Output 1 2 3 4 5 6

Constraints

1<=N,M<=10^4

Practice Union of Two Arrays free on ExecCode. Browse DSA problems, topic map, and placement guides.