Solved LeetCode program · 670 of 1,000
#0902 · Numbers At Most N Given Digit Set
Original English source
Keep a shared digits holding 1, 3, 5, and 7. Keep a shared counter of 0. The limit is 100.
To screen from value (a whole number). Set counter to 1. The rest is value.
Repeat while rest is more than 0.
The digit is rest modulo 10. If digits contains digit, set rest to rest divided by 10, otherwise set counter to 0, set rest to 0.
The total is 0.
For every value from 1 to limit.
Screen from value. If counter is 1, add 1 to total.
Show total.
Expected stdout
20