Complete the recursive fibonacci(n) method, where fib(0)=0, fib(1)=1, and fib(n) = fib(n-1) + fib(n-2) for n ≥ 2.
Input / Output
Input: a non-negative integer n (the position in the sequence, 0-indexed). Output: the nth Fibonacci number.
Examples
Input
6
Expected Output
8
Input
0
Expected Output
0
+ 2 hidden tests checked on Submit.
Main.java is the entry point. Add extra classes for OOP exercises — they compile together.
Run your code to see test results here.