1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-02 22:13:28 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-03-29 16:56:27 +08:00
parent e730aa6794
commit ad15da05aa
2517 changed files with 7358 additions and 7332 deletions

View File

@@ -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 &lt;= i &lt; j &lt;= n - 1</code> 且</li>\n\t<li><code>nums[i] * nums[j]</code> 能被 <code>k</code> 整除。</li>\n</ul>\n\n<p>&nbsp;</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>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>1 &lt;= nums[i], k &lt;= 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."