You are given a positive integer N. Your task is to compute the Nth Fibonacci number using tree recursion, where each function call makes two recursive calls to compute the previous two Fibonacci values.
The Fibonacci sequence follows:
F(0) = 0, F(1) = 1
F(n) = F(n-1) + F(n-2)
Return the value of the Nth Fibonacci number.
Example 1
Input: N = 5
Output: 5
Explanation: 0 1 1 2 3 5 ? the 5th Fibonacci number is 5.
Example 2
Input: N = 7
Output: 13
Explanation: 0 1 1 2 3 5 8 13 ? the 7th Fibonacci number is 13.
Example 3
Input: N = 0
Output: 0
Explanation: Base case returns 0.
Sign in to write, run, and submit your solution against the full test suite.