Search
⌘K

Leetcode 2657. Find the Prefix Common Array of Two Arrays

Given two permutations A and B of 1..n, produce array C where C[i] is the number of values that appear in both prefixes A[0..i] and B[0..i]; this is solved by incrementally tracking seen elements in each array and counting newly common values.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.