Go
\nfunc smallestRepunitDivByK(k int) int {\n    res := 1\n    n := 1 % k\n    set := make(map[int]bool)\n    set[n] = true\n    for n != 0 {\n        n = (n * 10
```\nfunc smallestRepunitDivByK(k int) int {\n    res := 1\n    n := 1 % k\n    set := make(map[int]bool)\n    set[n] = true\n    for n != 0 {\n        n = (n * 10 + 1) % k\n        if set[n] {\n            return -1\n        }\n        set[n] = true\n        res++\n    }\n    return res\n}\n```
[]