File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change @@ -46,9 +46,9 @@ https://leetcode-cn.com/problems/smallest-integer-divisible-by-k/
4646
4747这道题是说给定一个 K 值,能否找到一个形如 1,11,111,1111 。。。 的数字 n,使得 n % K == 0,并要求 n 尽可能地小。
4848
49- 由于题目要找一个尽可能小的 n ,那么我们可以从小到大进行枚举,知道找到这样的一个 n 值即可。即从 1,11,111,1111 。。。 这样一直除下去,直到碰到可以整除的,我们返回即可。
49+ 由于题目要找一个尽可能小的 n ,那么我们可以从小到大进行枚举,直到找到这样的一个 n 值即可。即从 1,11,111,1111 。。。 这样一直除下去,直到碰到可以整除的,我们返回即可。
5050
51- 但是如果这个数字根本就无法整除怎么办?没错,我们会无限循环下去。我们应该在什么时刻跳出循环返回 - 1 (表示不能整除)呢?
51+ 但是如果这个数字根本就无法整除怎么办?没错,我们会无限循环下去。那么我们应该在什么时刻跳出循环返回 - 1 (表示不能整除)呢?
5252
5353比如 k = 2 来说我们的算法过程如下:
5454
@@ -78,15 +78,7 @@ https://leetcode-cn.com/problems/smallest-integer-divisible-by-k/
7878
7979## 代码
8080
81- ``` python
82- #
83- # @lc app=leetcode.cn id=1015 lang=python3
84- #
85- # [1015] 可被 K 整除的最小整数
86- #
87-
88- # @lc code=start
89-
81+ ``` py
9082
9183class Solution :
9284 def smallestRepunitDivByK (self , K : int ) -> int :
You can’t perform that action at this time.
0 commit comments