Please enter your email address or userHandle.
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)
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.
For each case, a single integer that gives the maximum amount of pizzas that you can take.
Stack1 = Stack2 = 10
891 424 945 741 897 514 692 221 678 168
702 952 221 614 69 753 821 971 318 364
There is exactly one element common in both stack satisfying the given criteria, i.e. 221
There is no element common in both stack
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.