Prefix Common Array
You are given two permutations A and B of integers from 1 to n. For each index i, count how many distinct values have appeared in both A[0..i] and B[0..i] up to that position. Return the array of these prefix counts.
You are given two permutations A and B of integers from 1 to n. For each index i, count how many distinct values have appeared in both A[0..i] and B[0..i] up to that position. Return the array of these prefix counts.