LeetCode solutions

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

Read the problem on LeetCode View on GitHub

C++

Accepted on LeetCode — runtime 0ms, memory 42.3MB, accepted 2025-12-27.

cpp
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;
    }
};

Source