Tap here to switch tabs
Problem
Submissions

Problem: Find Common Elements Between Two Arrays

Find Common Elements Between Two Arrays counts indices in each array whose value appears at least once in the other, returning both totals in order.

Statement

Given two integer arrays nums1 and nums2 of sizes n and m respectively, calculate two values:

  • The number of indices i such that nums1[i] occurs at least once in nums2.

  • The number of indices i such that nums2[i] occurs at least once in nums1.

Return an integer array answer of size 22 containing the two calculated values in that order.

Constraints:

  • n == nums1.length

  • m == nums2.length

  • 1≤1 \leq n, m ≤100\leq 100

  • 1≤1 \leq nums1[i], nums2[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find Common Elements Between Two Arrays

Find Common Elements Between Two Arrays counts indices in each array whose value appears at least once in the other, returning both totals in order.

Statement

Given two integer arrays nums1 and nums2 of sizes n and m respectively, calculate two values:

  • The number of indices i such that nums1[i] occurs at least once in nums2.

  • The number of indices i such that nums2[i] occurs at least once in nums1.

Return an integer array answer of size 22 containing the two calculated values in that order.

Constraints:

  • n == nums1.length

  • m == nums2.length

  • 1≤1 \leq n, m ≤100\leq 100

  • 1≤1 \leq nums1[i], nums2[i] ≤100\leq 100