Search⌘ K
AI Features

Solution: Find the Prefix Common Array of Two Arrays

C# solution for the Find the Prefix Common Array of Two Arrays problem using the Hash Maps pattern.

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 11 to n.

Constraints:

  • 11 \leq ...