Best  Java Solution || Beats 95%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int smallestRepunitDivByK(int k) {\n        int prev = 0;\n\n        if(k%2==0 || k%5==0) return -1;\n\n        for(int i=1; i<=k; i++){\n            prev = (prev*10+1)%k;\n            if(prev == 0) return i;\n        }\n        return -1;\n    }\n}\n```
['Java']