mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-24 18:55:36 +08:00
build
This commit is contained in:
@ -182,6 +182,12 @@ comments: true
|
||||
}
|
||||
```
|
||||
|
||||
=== "Ruby"
|
||||
|
||||
```ruby title="iteration.rb"
|
||||
[class]{}-[func]{for_loop}
|
||||
```
|
||||
|
||||
=== "Zig"
|
||||
|
||||
```zig title="iteration.zig"
|
||||
@ -408,6 +414,12 @@ comments: true
|
||||
}
|
||||
```
|
||||
|
||||
=== "Ruby"
|
||||
|
||||
```ruby title="iteration.rb"
|
||||
[class]{}-[func]{while_loop}
|
||||
```
|
||||
|
||||
=== "Zig"
|
||||
|
||||
```zig title="iteration.zig"
|
||||
@ -649,6 +661,12 @@ comments: true
|
||||
}
|
||||
```
|
||||
|
||||
=== "Ruby"
|
||||
|
||||
```ruby title="iteration.rb"
|
||||
[class]{}-[func]{while_loop_ii}
|
||||
```
|
||||
|
||||
=== "Zig"
|
||||
|
||||
```zig title="iteration.zig"
|
||||
@ -883,6 +901,12 @@ comments: true
|
||||
}
|
||||
```
|
||||
|
||||
=== "Ruby"
|
||||
|
||||
```ruby title="iteration.rb"
|
||||
[class]{}-[func]{nested_for_loop}
|
||||
```
|
||||
|
||||
=== "Zig"
|
||||
|
||||
```zig title="iteration.zig"
|
||||
@ -1112,6 +1136,12 @@ comments: true
|
||||
}
|
||||
```
|
||||
|
||||
=== "Ruby"
|
||||
|
||||
```ruby title="recursion.rb"
|
||||
[class]{}-[func]{recur}
|
||||
```
|
||||
|
||||
=== "Zig"
|
||||
|
||||
```zig title="recursion.zig"
|
||||
@ -1318,8 +1348,9 @@ comments: true
|
||||
=== "Kotlin"
|
||||
|
||||
```kotlin title="recursion.kt"
|
||||
/* Kotlin tailrec 关键词使函数实现尾递归优化 */
|
||||
/* 尾递归 */
|
||||
tailrec fun tailRecur(n: Int, res: Int): Int {
|
||||
// 添加 tailrec 关键词,以开启尾递归优化
|
||||
// 终止条件
|
||||
if (n == 0)
|
||||
return res
|
||||
@ -1328,6 +1359,12 @@ comments: true
|
||||
}
|
||||
```
|
||||
|
||||
=== "Ruby"
|
||||
|
||||
```ruby title="recursion.rb"
|
||||
[class]{}-[func]{tail_recur}
|
||||
```
|
||||
|
||||
=== "Zig"
|
||||
|
||||
```zig title="recursion.zig"
|
||||
@ -1554,6 +1591,12 @@ comments: true
|
||||
}
|
||||
```
|
||||
|
||||
=== "Ruby"
|
||||
|
||||
```ruby title="recursion.rb"
|
||||
[class]{}-[func]{fib}
|
||||
```
|
||||
|
||||
=== "Zig"
|
||||
|
||||
```zig title="recursion.zig"
|
||||
@ -1890,6 +1933,12 @@ comments: true
|
||||
}
|
||||
```
|
||||
|
||||
=== "Ruby"
|
||||
|
||||
```ruby title="recursion.rb"
|
||||
[class]{}-[func]{for_loop_recur}
|
||||
```
|
||||
|
||||
=== "Zig"
|
||||
|
||||
```zig title="recursion.zig"
|
||||
|
Reference in New Issue
Block a user