In the Find the Number of Good Pairs I interview question, you are given two arrays, nums1 and nums2, and an integer k. A pair is called "good" if nums1[i] is divisible by nums2[j] * k. You need to return the total number of such good pairs.
Airbus and Google use this "Easy" question to test basic loop logic and divisibility checks. It evaluation whether you can correctly iterate through two datasets and apply a multi-factor condition. While simple, it’s a good test of a candidate's ability to implement a brute-force approach accurately before considering optimizations for larger datasets.
This problem follows an Enumeration (Nested Loops) pattern.
count = 0.nums1.nums2.x % (y * k) == 0.count.nums1 = [12, 6], nums2 = [2, 3], k = 1
(x * k) % y instead of x % (y * k).For "Version I" of a problem, a brute-force solution is usually expected and sufficient given the small constraints. Always state the complexity of your solution to show you are aware of its performance.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Find Anagram Mappings | Easy | Solve | |
| N-Repeated Element in Size 2N Array | Easy | Solve | |
| Distribute Candies | Easy | Solve | |
| Max Pair Sum in an Array | Easy | Solve | |
| Minimum Number of Operations to Make Elements in Array Distinct | Easy | Solve |