Find the Prefix Common Array of Two Arrays
Track the values seen so far in each permutation with two sets; each new value that the other side has already seen adds one to the running count.
Track the values seen so far in each permutation with two sets; each new value that the other side has already seen adds one to the running count.