c++ solution , beats 100%
class Solution {\npublic:\n    int smallestRepunitDivByK(int k) {\n        \n        int i =0;\n        if(k%2==0 || k%5==0)\n            return -1;\n        in
class Solution {\npublic:\n    int smallestRepunitDivByK(int k) {\n        \n        int i =0;\n        if(k%2==0 || k%5==0)\n            return -1;\n        int mod = 0;\n        while(true)\n        {\n            mod = (mod*10 + 1)%k;\n            i++;\n            if(mod==0)\n                return i;\n            \n        }\n        return -1 ;\n    }\n};
[]