Given the number k, return the minimum number of Fibonacci numbers whose sum is equal to k, whether a Fibonacci number could be used multiple times.
The Fibonacci numbers are defined as:
F * 1 = 1 F * 2 = 1 Fn = Fn – 1 + Fn – 2 , for n > 2
It is guaranteed that for the given constraints we can always find such fibonacci numbers that sum k.
Input: k = 7
Output: 2
New contributor
yash mhaske is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1