Solution: Find the Prefix Common Array of Two Arrays
C# solution for the Find the Prefix Common Array of Two Arrays problem using the Knowing What to Track pattern.
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 fromto .
Constraints:
...