Determine required digits in each number place without looping

57 Views Asked by At

Given a number range that starts with 1.0 and ends at 2.0, and steps every 0.25, if you printed it out (formatted), it would be 1.00; 1.25; 1.50; 1.75; 2.00; 2.25; etc...

Without having to loop through the range, how can I determine which digits will ever be needed in each place within the range? For example, that in the decimal 100th’s place, only the digits 0 and 5 will ever be needed? And in the decimal 10th’s place, only the digits 0, 2, 5, and 7 will ever be used? The solution would need to be able to support any range and step values.

0

There are 0 best solutions below