Search⌘ K
AI Features

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...

Statement

Given two integer arrays A and B of equal length n, define an array C of length n such that for each index i, C[i] equals the count of values that appear in both prefixes A[0..i] and B[0..i] (count each value at most once).

Return the array C.

Note: A and B are permutations of the integers from ...