AlgoUniversity
  • Go Back
Discussion
Uncommon Elements :

Author

Shikhar Mehrotra

Difficulty Level : Medium

Submissions : 194

Asked In : Qualcomm

Marks :50

: 3 | : 0

You are given two arrays $$$A$$$ and $$$B$$$ of length $$$N$$$ and $$$M$$$ respectively.

Your task is to find the uncommon elements in both arrays $$$A$$$ and $$$B$$$

Uncommon elements of $$$A$$$ and $$$B$$$ are list of elements which are in $$$A$$$ , but not in $$$B$$$ and also which are in $$$B$$$ , but not in $$$A$$$.

Output the list of uncommon elements in sorted order with no repetitions.

Input

The first line contains two space-separated integers $$$1\le N \le 10^{5}$$$ and $$$1\le M \le 10^{5}$$$

The second line contains $$$N$$$ space-separated integers $$$1\le A[i]\le 10^{9}$$$, $$$1\le i\le N$$$

The third line contains $$$M$$$ space-separated integers $$$1\le B[i]\le 10^{9}$$$, $$$1\le i\le M$$$

Output

Output the list of uncommon elements in sorted order with no repetitions.

Example

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

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.