fix: predicate

This commit is contained in:
nuomi1
2023-01-08 23:48:35 +08:00
parent 5e23c75870
commit e6021ff59e
2 changed files with 3 additions and 3 deletions

View File

@ -1481,7 +1481,7 @@ $$
func bubbleSort(nums: inout [Int]) -> Int {
var count = 0 // 计数器
// 外循环:待排序元素数量为 n-1, n-2, ..., 1
for i in sequence(first: nums.count - 1, next: { $0 > 0 ? $0 - 1 : nil }) {
for i in sequence(first: nums.count - 1, next: { $0 > 0 + 1 ? $0 - 1 : nil }) {
// 内循环:冒泡操作
for j in 0 ..< i {
if nums[j] > nums[j + 1] {