We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I don’t know if this helps with a solution per se, but there is an O(N) way to answer the SE OP’s question and I was hoping you could add this to your answer. Observe that the number of ways to represent a value is (0) keyed to the 2nd LSB and greater (a parity thingy), (1) builds on the previous—i.e. two values before—number of ways by adding 2 to each value, (2) also includes some other previous step by adding a 0 or 1 to the RHS, and (3) if past 9, then excludes parts corresponding to some previous step because digits do not go to hex-like A/B as a result of (1).
Specifically, (2) refers to half the value and (3) refers to half of 10 less than the value. If I’m counting all this correctly, anyhow.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Decibinary Numbers
You are viewing a single comment's thread. Return to all comments →
I don’t know if this helps with a solution per se, but there is an O(N) way to answer the SE OP’s question and I was hoping you could add this to your answer. Observe that the number of ways to represent a value is (0) keyed to the 2nd LSB and greater (a parity thingy), (1) builds on the previous—i.e. two values before—number of ways by adding 2 to each value, (2) also includes some other previous step by adding a 0 or 1 to the RHS, and (3) if past 9, then excludes parts corresponding to some previous step because digits do not go to hex-like A/B as a result of (1).
Specifically, (2) refers to half the value and (3) refers to half of 10 less than the value. If I’m counting all this correctly, anyhow.