LeetCode Solutions/LeetCoding Challenge/November 2019 LeetCoding Challenge/Smallest Integer Divisible by K.java
class 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;
    }
}