10031. Find Common Elements Between Two Arrays
You are given two 0-indexed integer arrays
nums1
andnums2
of sizesn
andm
, respectively.Consider calculating the following values:
- The number of indices
i
such that0 <= i < n
andnums1[i]
occurs at least once innums2
.- The number of indices
i
such that0 <= i < m
andnums2[i]
occurs at least once innums1
.Return an integer array
answer
of size2
containing the two values in the above order.
1 | class Solution { |