Search
⌘K

Leetcode 3164. Find the Number of Good Pairs II

Count how many index pairs (i, j) satisfy nums1[i] being divisible by nums2[j] * k. With arrays up to 1e5 and values up to 1e6, the challenge is to efficiently count multiplicative/divisibility relationships (e.g., via frequency counts and iterating multiples/divisors) rather than using brute-force O(n*m).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.