Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
lucifer committed Jan 6, 2020
1 parent cdc6a17 commit d0b0542
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions problems/60.permutation-sequence.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d0b0542

Please sign in to comment.