+ 1
Fibonacci code challenge
What is the output of the following code? func fib(n: Int) -> Int { return n < 2 ? N :(fib(n-1) + (fib(n-2)) } print(fib(3))
1 Odpowiedź
+ 2
The output should be 2.
What is the output of the following code? func fib(n: Int) -> Int { return n < 2 ? N :(fib(n-1) + (fib(n-2)) } print(fib(3))