This commit is contained in:
krahets
2024-03-21 04:22:07 +08:00
parent 35a07170c0
commit cfdb743939
52 changed files with 292 additions and 290 deletions

View File

@ -1631,7 +1631,7 @@ comments: true
var stack: [Int] = []
var res = 0
// 递:递归调用
for i in stride(from: n, to: 0, by: -1) {
for i in (1 ... n).reversed() {
// 通过“入栈操作”模拟“递”
stack.append(i)
}