Problem Statement
A fibonacci sequence is defined recursively as follows:
- F1 = F2 = 1;
- Fn = Fn-1 + Fn-2;
Definition
- Class:
- FibonacciSequence
- Method:
- numFibs
- Parameters:
- int, int
- Returns:
- int
- Method signature:
- int numFibs(int a, int b)
- (be sure your method is public)
Constraints
- a will be between 2 and 1000, inclusive.
- b will be between a and 1000, inclusive.
Examples
2
5
Returns: 3
The fibonacci sequence is {1,1,2,3,5,...}. There are 3 fibonacci numbers between 2 and 5, inclusive: {2,3,5}.12
13
Returns: 1
13
13
Returns: 1