Alorgrithm-Fibo

Run Settings
LanguageSwift
Language Version
Run Command
func generateFibonaccis(_ n: Int) -> [Int] { if (n < 2) { return [1] } var fib = Array(repeating: 1, count: n) for i in 2..<n { fib[i] = fib[i - 2] + fib[i - 1] } return fib } let num = Int(readLine(strippingNewline: true) ?? "2" ) ?? 1 var fib = generateFibonaccis(num) print(fib.map({"\($0)"}).joined(separator: " "))
Editor Settings
Theme
Key bindings
Full width
Lines