C++ | easy
\nclass Solution {\npublic:\n    int smallestRepunitDivByK(int k) {\n        int ans=1;\n        int num=0;\n        while(ans<100000){\n            num=num*10+
```\nclass Solution {\npublic:\n    int smallestRepunitDivByK(int k) {\n        int ans=1;\n        int num=0;\n        while(ans<100000){\n            num=num*10+1;\n            if(num>=k) num=num%k;\n            if(num==0) return ans;\n            ans++;\n        }\n        return -1;\n    }\n};\n```
['C', 'C++']