✅Easiest & Short Code in C++||O(1)SC✅✅
Complexity\n- Time complexity:\nO(k)\n\n- Space complexity:\nO(1)\n\n# Code\nPlease upvote if u liked my Solution\uD83D\uDE42\n\nclass Solution {\npublic:\n    
# Complexity\n- Time complexity:\nO(k)\n\n- Space complexity:\nO(1)\n\n# Code\n**Please upvote if u liked my Solution**\uD83D\uDE42\n```\nclass Solution {\npublic:\n    int smallestRepunitDivByK(int k) {\n        if((k & 1)==0 || k==5)\n            return -1;\n        int n=0;\n        for(int i=0;i<k;i++){\n            n = (n * 10) % k + (1 % k);  //using the modulo property i.e ((a*b)+c)%k == ((a*b)%k + c%k)%k\n            if(n % k == 0)\n                return i+1;\n        }\n        return -1;\n    }\n};\n```
['Math', 'C++']