A good answer might be:

The complete rule is below.


Static View

Here is the complete math-like definition for the Fibonacci series. There are two base cases. This is fine. Recursion breaks problems into smaller pieces. After enough breaking, all that remains are the base cases that can be solved immediately. There can be any number of base cases.

Fib( 1 ) = 1       (base case)

Fib( 2 ) = 1       (base case)

Fib( N ) = Fib( N-1 ) + Fib( N-2 )

We have a math-like definition. Creating a Java method to implement it should be a matter of text-level translation.

public int Fib( int N )
{
  if       ( ________ ) 
  
    return _______;
    
  else if  ( ________ ) 
  
    return _______;
    
  else
  
    return ________ + ________;
}

QUESTION 16:

Sharpen your translation skills by filling those blanks.