We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5cc6315 commit d451882Copy full SHA for d451882
lcof/面试题10- I. 斐波那契数列/README.md
@@ -177,6 +177,25 @@ public class Solution {
177
}
178
```
179
180
+#### Swift
181
+
182
+```swift
183
+class Solution {
184
+ func fib(_ n: Int) -> Int {
185
+ var a = 0
186
+ var b = 1
187
+ var count = n
188
+ while count > 0 {
189
+ let c = (a + b) % 1000000007
190
+ a = b
191
+ b = c
192
+ count -= 1
193
+ }
194
+ return a
195
196
+}
197
+```
198
199
<!-- tabs:end -->
200
201
<!-- solution:end -->
lcof/面试题10- I. 斐波那契数列/Solution.swift
@@ -0,0 +1,14 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
0 commit comments