LeetCode Solutions/December 2021 LeetCoding Challenge/Smallest Integer Divisible by K/Smallest Integer Divisible by K.java
<gh_stars>0class Solution {
    public int smallestRepunitDivByK(int k) {
        if (k % 2 == 0 || k % 5 == 0){
            return -1;
        }
        int r = 0;
        for (int N=1; N<k+1; N++){
            r = (r * 10 + 1) % k;
            if (r == 0){
                return N;
            }
        }
        return 0;
    }
}