Skip to content

Instantly share code, notes, and snippets.

@maniish-jaiin
Created April 8, 2021 20:14
fun fibonacci(n: Int, a: Int = 0, b: Int = 1): Int =
when (n) {
0 -> a
1 -> b
else -> fibonacci(n - 1, b, a + b)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment