Easy Understandable Code | c++
\n\'\'\'\nclass Solution {\npublic:\n    int smallestRepunitDivByK(int k) {\n        if(k==1) return 1;\n        if(k%2==0 || k%5==0) return -1;\n        int re
```\n\'\'\'\nclass Solution {\npublic:\n    int smallestRepunitDivByK(int k) {\n        if(k==1) return 1;\n        if(k%2==0 || k%5==0) return -1;\n        int rem = 0;\n        for(int i = 1; i<=k ;i++){\n            rem = (rem*10+1)%k;\n                if(rem == 0){\n                    return i;\n                }\n        }\n        return -1;\n    }\n};\n\'\'\'\n```
['Math', 'C']