How many pizzas ?
Basic Accuracy: 33.56% Submissions: 1861 Points: 1

You are given two stacks of pizzas, but you can only take those pizzas from one stack that are also present in the other stack, in the same order, the pizzas that you can take need not be continuous.

Print the maximum amount of pizzas that you can take. (You can only take pizzas from one of the two stacks)

INPUT
The first line contains only one integer, t, the number of test cases.
For each case, there are two lines: 

Line 1: 10 integers, which represent radii of the pizzas in the first stack.
Line 2: 10 integers, each of which represent radii of pizzas in the second stack.

OUTPUT:
For each case, a single integer that gives the maximum amount of pizzas that you can take.

Constraints:
1<=T<=104
Stack1 = Stack2 = 10
1<=radii<=103

Example:
Input:

1
891 424 945 741 897 514 692 221 678 168
702 952 221 614 69 753 821 971 318 364
Output:
1

0

Explanation:
Testcase:1

There is exactly one element common in both stack satisfying the given criteria, i.e. 221
Testcase:2
There is no element common in both stack

 

 

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.