As you can see, each value from 2 on is the sum of the previous two values. Any positive integer can be written as a sum of values taken from the Fibonacci sequence. These values need not be distinct. Return the smallest number of such values that sum to n.
int howMany(int n)
(be sure your method is public)
n will be between 1 and 1000000 inclusive.
Just a single number is required.
The best we can do is 5+2 = 7.
The best here is 34+34+2 = 70.
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.