From d0b0542bd8d3d8f66af3c1fda9a12a033c9f4fc8 Mon Sep 17 00:00:00 2001 From: lucifer Date: Mon, 6 Jan 2020 18:42:35 +0800 Subject: [PATCH] fix: typo --- problems/60.permutation-sequence.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/problems/60.permutation-sequence.md b/problems/60.permutation-sequence.md index c9bd1567d..c6706f076 100644 --- a/problems/60.permutation-sequence.md +++ b/problems/60.permutation-sequence.md @@ -83,12 +83,12 @@ class Solution: while n != 0: facto = math.factorial(n - 1) # i 表示前面被我们排除的组数,也就是k所在的组的下标 - # k // facto 是不行的, 加入k % facto == 0就会有问题 + # k // facto 是不行的, 比如在 k % facto == 0的情况下就会有问题 i = math.ceil(k / facto) - 1 # 我们把candidates[i]加入到结果集,然后将其弹出candidates(不能重复使用元素) res += candidates[i] candidates.pop(i) - # k 缩小了 facto* i + # k 缩小了 facto * i k -= facto * i # 每次迭代我们实际上就处理了一个元素,n 减去 1,当n == 0 说明全部处理完成,我们退出循环 n -= 1