Easy C++ Solution..... Just 5 lines of Code
class Solution {\npublic:\n\n    int smallestRepunitDivByK(int k) {\n        if(k%5==0 or k%2==0)    return -1;\n        int rem=0;\n        for(int i= 1; i<=k;
class Solution {\npublic:\n\n    int smallestRepunitDivByK(int k) {\n        if(k%5==0 or k%2==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)  return i;\n        }\n        return -1;\n    }\n};
['Math', 'C', 'C++']