Solved LeetCode program · 779 of 1,000
#1015 · Smallest Integer Divisible by K
Original English source
The divisor is 3. The remainder is 0. The length is 0. The answer is -1.
Repeat while length is less than divisor and answer is less than 0.
Add 1 to length. Set remainder to (remainder times 10 plus 1) modulo divisor. If remainder is 0, set answer to length.
Show answer.
Expected stdout
3