how to find distinct digit set numbers over a range of integers?

Posted by evil.coder on Stack Overflow See other posts from Stack Overflow or by evil.coder
Published on 2010-04-07T12:32:07Z Indexed on 2010/04/07 12:43 UTC
Read the original article Hit count: 276

Filed under:
|

Suppose i have a unsigned integer, call it low and one another call it high such that high>low. The problem is to find distinct digit set numbers over this range. For example, suppose low is 1 and high is 20 then the answer is 20, because all the numbers in this range are of distinct digit sets. If suppose low is 1 and high is 21, then the answer is 20, because 12 and 21 have same digit set i.e.1, 2. I am not looking for a bruteforce algo., if anyone has a better solution then a usual bruteforce approach, please tell..

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about mathematics