2657. Find the Prefix Common Array of Two Arrays
You are given two 0-indexed integer permutations
A
andB
of lengthn
.A prefix common array of
A
andB
is an arrayC
such thatC[i]
is equal to the count of numbers that are present at or before the indexi
in bothA
andB
.Return the prefix common array of
A
andB
.A sequence of
n
integers is called a permutation if it contains all integers from1
ton
exactly once.
1 | class Solution { |