mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 22:13:28 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个下标从 <strong>0</strong> 开始、长度为 <code>n</code> 的整数数组 <code>nums</code> 和一个整数 <code>k</code> ,返回满足下述条件的下标对 <code>(i, j)</code> 的数目:</p>\n\n<ul>\n\t<li><code>0 <= i < j <= n - 1</code> 且</li>\n\t<li><code>nums[i] * nums[j]</code> 能被 <code>k</code> 整除。</li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>nums = [1,2,3,4,5], k = 2\n<strong>输出:</strong>7\n<strong>解释:</strong>\n共有 7 对下标的对应积可以被 2 整除:\n(0, 1)、(0, 3)、(1, 2)、(1, 3)、(1, 4)、(2, 3) 和 (3, 4)\n它们的积分别是 2、4、6、8、10、12 和 20 。\n其他下标对,例如 (0, 2) 和 (2, 4) 的乘积分别是 3 和 15 ,都无法被 2 整除。 \n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>nums = [1,2,3,4], k = 5\n<strong>输出:</strong>0\n<strong>解释:</strong>不存在对应积可以被 5 整除的下标对。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= nums[i], k <= 10<sup>5</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 38,
|
||||
"likes": 39,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3.7K\", \"totalSubmission\": \"13.8K\", \"totalAcceptedRaw\": 3683, \"totalSubmissionRaw\": 13829, \"acRate\": \"26.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"3.7K\", \"totalSubmission\": \"13.9K\", \"totalAcceptedRaw\": 3706, \"totalSubmissionRaw\": 13890, \"acRate\": \"26.7%\"}",
|
||||
"hints": [
|
||||
"For any element in the array, what is the smallest number it should be multiplied with such that the product is divisible by k?",
|
||||
"The smallest number which should be multiplied with nums[i] so that the product is divisible by k is k / gcd(k, nums[i]). Now think about how you can store and update the count of such numbers present in the array efficiently."
|
||||
|
Reference in New Issue
Block a user