Easy Beginner Solution || No HashMap
\n# Approach\n Describe your approach to solving the problem. \nUse 2 for loops to check every possible combination.\n\n# Complexity\n- Time complexity: 0(n^2)\
\n# Approach\n<!-- Describe your approach to solving the problem. -->\nUse 2 `for` loops to check every possible combination.\n\n# Complexity\n- Time complexity: 0(n^2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: 0(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n        int count = 0; // Initialize a counter to keep track of valid pairs\n\n        // Iterate through each element in nums1\n        for (int n1 : nums1)\n            // For each element in nums2\n            for (int n2 : nums2) \n                // Check if n1 is divisible by (n2 * k)\n                if (n1 % (n2 * k) == 0)\n                    count++;\n        return count; // Return the total count of valid pairs\n    }\n};\n\n```\n![Cat asking for an Upvote.jpeg](https://assets.leetcode.com/users/images/f986dda5-2a3d-4307-971f-3e2a5c87516c_1716728077.7081504.jpeg)\n
['Array', 'C++']