Can someone please help me solve this problem?
Sample tests: Input 1: int[] A = {0,0,0,1,1,1,9,9,9}; int[] B = {7,8,1,2,3,9,4,5,6};
int[] A = {0,0,0,1,1,1,9,9,9};
int[] B = {7,8,1,2,3,9,4,5,6}
Output 1: 10
10
Input 2: int[] A = {0,1,1} int[] B = {1,2,3}
int[] A = {0,1,1}
int[] B = {1,2,3}
Output2: 3
3