10031. Find Common Elements Between Two Arrays
You are given two 0-indexed integer arrays
nums1andnums2of sizesnandm, respectively.Consider calculating the following values:
- The number of indices
isuch that0 <= i < nandnums1[i]occurs at least once innums2.- The number of indices
isuch that0 <= i < mandnums2[i]occurs at least once innums1.Return an integer array
answerof size2containing the two values in the above order.
1 | class Solution { |