5
$\begingroup$

I have to find out number of integers that have every digit $(0-9)$ in it where integer starting with zero doesn't count i.e leading zero shouldn't be there. So this makes the length of an integer $ \ge 10$.

For eg - for $10$ length $1234567890,9876543201,4567891023$ and so on

For 11 length = $12345678900, 12345678009$ and so on..

For $19$ length =$1122334556677889900,99887766554433220011$ and so on..

Now given a range $L,R$ I need to find out how many such integers falls in between them. Now I was trying out all combinations and checking if it lies within range. Is there a way to apply permutation and combination to do so efficiently and smartly ?

$\endgroup$
  • $\begingroup$ what about 11234567890? that has length 11... $\endgroup$ – danimal Apr 10 '17 at 15:05
  • $\begingroup$ @danimal Yeah it will count. Oops I forgot to take them into account. I updated my question. $\endgroup$ – S.H. Apr 10 '17 at 15:07
  • 1
    $\begingroup$ @user2460798 Yes they can be repeated otherwise how else would they make up integers of more than $9$ length ? $\endgroup$ – S.H. Apr 10 '17 at 15:10
  • $\begingroup$ @BarryCipra No. Sorry it's an error on my part. You are right, it should be "10 length" and "11 length" $\endgroup$ – S.H. Apr 10 '17 at 15:28
  • 1
    $\begingroup$ @N.Shales I think he said range of numbers not range of number of digits ! $\endgroup$ – Rezwan Arefin Apr 11 '17 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.