Tap here to switch tabs
Problem
Submissions

Problem: Find the Number of Good Pairs II

Try to solve the Find the Number of Good Pairs II problem.

Statement

You are given two integer arrays nums1 and nums2 of lengths n and m respectively, and a positive integer k.

A pair (i, j) is defined as good if 0≤i<n0 \leq i < n, 0≤j<m0 \leq j < m, and nums1[i] is divisible by nums2[j] $ imes$ k.

Return the total count of good pairs.

Constraints:

  • 1≤1 \leq n, m ≤105\leq 10^5

  • 1≤1 \leq nums1[i], nums2[j] ≤106\leq 10^6

  • 1≤1 \leq k ≤103\leq 10^3

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Number of Good Pairs II

Try to solve the Find the Number of Good Pairs II problem.

Statement

You are given two integer arrays nums1 and nums2 of lengths n and m respectively, and a positive integer k.

A pair (i, j) is defined as good if 0≤i<n0 \leq i < n, 0≤j<m0 \leq j < m, and nums1[i] is divisible by nums2[j] $ imes$ k.

Return the total count of good pairs.

Constraints:

  • 1≤1 \leq n, m ≤105\leq 10^5

  • 1≤1 \leq nums1[i], nums2[j] ≤106\leq 10^6

  • 1≤1 \leq k ≤103\leq 10^3