Explanation
Actually this problem is similar with decimal to binary conversion but in this case you use a fibonacci sequence as a base. First thing to do is generate all fibonacci number less than 100.000.000 and store it in the array size of 50 or less (the 50th number in fibonacci number is 12.586.269.025). After generating the fibonacci sequence, you can backward iterate the array.
- If you found number less than or equal to the input, append string result with "1" and subtract the input.
- else append string with "0".
Source Code
Tidak ada komentar:
Posting Komentar