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:
AandBare permutations of the integers fromto n.
Constraints:
A.length B.length n
A[i], B[i] n
It is guaranteed that A and B are both a permutation of n integers.
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:
AandBare permutations of the integers fromto n.
Constraints:
A.length B.length n
A[i], B[i] n
It is guaranteed that A and B are both a permutation of n integers.