The TransCompilator

Solved LeetCode program · 776 of 1,000

#1012 · Numbers With Repeated Digits

Hard Math chunk-16.md

Original English source

Keep a shared duplicated of 0.

To screen from number (a whole number). Set duplicated to 0. If number is 0, return. The seen is a list of 10 zeros. The rest is number.
Repeat while rest is more than 0.
The digit is rest modulo 10. If item digit of seen is 1, set duplicated to 1. Set item digit of seen to 1. Set rest to rest divided by 10.

The limit is 100. The total is 0.
For every number from 0 to limit.
Screen from number. If duplicated is 1, add 1 to total.

Show total.

Open in Playground Browse all 1,000 problems

Expected stdout

10