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