Question: must be written in java You are given two list of integers. You can remove any number of elements from any of them. You have

must be written in java

You are given two list of integers. You can remove any number of elements from any of them. You have to ensure that after removing some elements both of the list will contain same elements, but not necessarily in same order. For example consider the following two lists

must be written in java You are given two list of integers.

After removing 1 from first list and 5 from second list, both lists will contain same elements. We will find the following lists after removing two elements.

You can remove any number of elements from any of them. You

What is the minimum number of elements to be removed to obtain two list having same elements?

Input

The first line of the input file contains an integer T (T 100) which denotes the total number of test cases. The description of each test case is given below:

First line will contain two integers N (1 N 10000), the number of element in the first list and M (1 M 10000), the number of element in the second list. The next line will contain N integers representing the first list followed by another line having M elements representing the second list. Each integers in the input is 32 bit signed integer.

Output

For each test case output a single line containing the number of elements to be removed. See sample output for exact format.

Sample Input

1 55 12321 12523

Sample Output

2

List #1 | 1 2 3 2 1 List #2 | 12523 List #1 | 1232 List #2 | 1 2 2 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!