Find the Prefix Common Array of Two Arrays
Try to solve the Find the Prefix Common Array of Two Arrays problem.
We'll cover the following...
We'll cover the following...
Statement
You are given two integer arrays A and B of equal length n. For each index i, consider the prefixes A[0..i] and B[0..i]. Define C[i] as the number of distinct values that appear in both prefixes. Return the array C of length n.
Note:
AandBare permutations of the integers from...