3446. Find the Number of Good Pairs I
My accepted C++ solution to LeetCode problem 3446, Find the Number of Good Pairs I, running in 0ms.
- Difficulty: Easy
- C++
- Runtime 0ms
- Memory 42.3MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
C++
Accepted on LeetCode — runtime 0ms, memory 42.3MB, accepted 2025-12-27.
class Solution {
public:
int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {
int count = 0;
for (int a : nums1)
for (int b : nums2)
if (a % (b * k) == 0) count++;
return count;
}
};