Given two arrays A and B of equal number of elements. The task is to find the maximum sum possible of a window in array B such that elements of same window in array A are unique.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. First line of each test case starts with an integer N denoting the size of the arrays A and B. Second line of input contains N space separated integers Of array A. And third line of input contains N space separated integers Of array B.
For each test case, print the maximum possible sum In new line.
0 1 2 3 0 1 4
9 8 1 2 3 4 5
0 1 2 0 2
5 6 7 8 2
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.