Skip to content

Instantly share code, notes, and snippets.

@yeonwooz
Last active March 11, 2022 08:58
Show Gist options
  • Save yeonwooz/7f53d8c5c8e16e37f6d487362e3e92de to your computer and use it in GitHub Desktop.
Save yeonwooz/7f53d8c5c8e16e37f6d487362e3e92de to your computer and use it in GitHub Desktop.
Fibonacci
public static uint Fibo(uint n)
{
if (n <= 1) // 3. base case
{
return n;
}
// 1. recursive step
return Fibo(n - 1) + Fibo(n - 2);
// 2-1. output is sum of former two elements. it becomes next input.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment