Odometer-like Brute-force Counter in C


/ Published in: C
Save to your folder(s)

Given a sorted set of digits, print all of them in counting order.
digits[] - the set of digits allowed. They are assumed to be in the set {0-9}, but it will work with larger numbers as well.
range - the length of the resulting number (i.e., how many digits to print)
numDigits - the size of the set of digits represented by digits[]

There are probably slicker ways to do this: see http://stackoverflow.com/questions/228796/algorithm-odometer-brute-force
but this one is fast.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.