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.
For the second sentence, I agree and my further hint is to count a space " " as a digit higher than 9 when counting the decreasing sequences recursively. For example, "10" is a decreasing 2-digit number but padding a leading zero "010" switches it to bouncy, whereas padding it with a high-valued leading space makes it " 10", thus retaining it as decreasing.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Join us
Create a HackerRank account
Be part of a 26 million-strong community of developers
Please signup or login in order to view this challenge
Project Euler #113: Non-bouncy numbers
You are viewing a single comment's thread. Return to all comments →
I arrived at the formula (k+9)C9+(k+10)C10 - 10*k - 2 non bouncy numbers less than 10^k using pen and paper. (combinatorics)
Also number of increasing and decreasing non bouncy numbers won't be the same, some people might make that mistake.
Indeed, it may help to understand Rota's famous 12-fold way of counting functions N⟶X.
For the second sentence, I agree and my further hint is to count a space " " as a digit higher than 9 when counting the decreasing sequences recursively. For example, "10" is a decreasing 2-digit number but padding a leading zero "010" switches it to bouncy, whereas padding it with a high-valued leading space makes it " 10", thus retaining it as decreasing.