2657. Find the Prefix Common Array of Two Arrays
You are given two 0-indexed integer permutations
AandBof lengthn.A prefix common array of
AandBis an arrayCsuch thatC[i]is equal to the count of numbers that are present at or before the indexiin bothAandB.Return the prefix common array of
AandB.A sequence of
nintegers is called a permutation if it contains all integers from1tonexactly once.
1 | class Solution { |