#3162

Find the Number of Good Pairs I

easy · 86.3% accepted · 164 likes · top 97%

array · hash table

⊣ practice⊣ open on leetcode ↗

Description

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

A pair (i, j) is called good if nums1[i] is divisible by nums2[j] * k (0 <= i <= n - 1, 0 <= j <= m - 1).

Return the total number of good pairs.

Solution