Leaderboard
Showing:
In First But Second
Medium Accuracy: 43.29% Submissions: 22529 Points: 4

Given two arrays A and B of positive integers. Your task is to find numbers which are present in the first array, but not present in the second array.

Input:
The first line of input contains an integer T denoting the number of test cases. Each test case contains space separated integers N and M which denotes the number of elements in the array A and B. Next two line contains space separated array elements.

Output:
Print space separated numbers present in the first array but not in the second.
 
Constraints:
1 <= T <= 100
1 <= N, M <= 107
1 <= Ai,Bi <= 1018

Example:
Input:

2
6 5
1 2 3 4 5 10
2 3 1 0 5
5 5
4 3 5 9 11
4 9 3 11 10

Output:
4 10 
5

Explanation:
Testcase 1: 4 and 10 are present in first array while not in second array.

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

In First But Second

Output Window