Mr Fibonacci does some Encoding
CodeChefOpen on judge ↗
Every positive integer can be represented uniquely as the sum of one or more distinct Fibonacci numbers in such a way that the sum does not include any two consecutive Fibonacci numbers. With the help of the above proposition, every integer can be encoded into a sequence of 0s and 1s. For a number N, if d(0), d(1), d(2)...d(k-1) and d(k) represent the digits of the code word representing N then
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start