Add Swift language blocks to the docs.

This commit is contained in:
Yudong Jin
2023-01-08 19:41:05 +08:00
parent 3ba37dba3a
commit 73e3452838
22 changed files with 414 additions and 70 deletions

View File

@ -421,12 +421,12 @@ $$
```go title=""
func algorithm(n int) {
a := 1 // +1
a = a + 1 // +1
a = a * 2 // +1
a := 1 // +1
a = a + 1 // +1
a = a * 2 // +1
// 循环 n 次
for i := 0; i < n; i++ { // +1
fmt.Println(a) // +1
for i := 0; i < n; i++ { // +1
fmt.Println(a) // +1
}
}
```
@ -2657,7 +2657,7 @@ $$
=== "Swift"
```swift title=""
```swift title="worst_best_time_complexity.swift"
// 生成一个数组,元素为 { 1, 2, ..., n },顺序被打乱
func randomNumbers(n: Int) -> [Int] {
// 生成数组 nums = { 1, 2, 3, ..., n }