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.
Solved this after 3 days of analysis. Algorithm must be O(logN), otherwise it will time out. I process number digit by digit and update the count value. I created auxilarry arrays with values like:
- number of reversible numbers for given number of digits and its cumulative sum
- number of odd digit sums without carry over (exluding digit 0) and its cumulative sums
- number of odd digit sum without carry over (including digit 0) and its cumulative sums
- number of odd digits sums with carry over and its cumultaive sums
- number of even digit sums without carryover and its cumulative sums
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #145: How many reversible numbers are there below one-billion?
You are viewing a single comment's thread. Return to all comments →
Solved this after 3 days of analysis. Algorithm must be O(logN), otherwise it will time out. I process number digit by digit and update the count value. I created auxilarry arrays with values like: - number of reversible numbers for given number of digits and its cumulative sum - number of odd digit sums without carry over (exluding digit 0) and its cumulative sums - number of odd digit sum without carry over (including digit 0) and its cumulative sums - number of odd digits sums with carry over and its cumultaive sums - number of even digit sums without carryover and its cumulative sums