Golang O(K)/O(1) and O(K)/O(K)
Time: O(K), Space: O(K)\n\n\nfunc smallestRepunitDivByK(K int) int {\n    m := make(map[int]bool)\n    n := 0\n    for i := 1; ; i++ {\n        n = n*10 + 1\n  
Time: O(K), Space: O(K)\n\n```\nfunc smallestRepunitDivByK(K int) int {\n    m := make(map[int]bool)\n    n := 0\n    for i := 1; ; i++ {\n        n = n*10 + 1\n        n = n%K\n        if n == 0 { return i }\n        if m[n] { return -1 }\n        m[n] = true\n    }\n}\n```\n\nTime: O(K), Space: O(1)\n```\nfunc smallestRepunitDivByK(K int) int {\n    for n, i := 0, 1; i<=K; i++ {\n        n = n*10 + 1\n        n = n%K\n        if n == 0 { return i }\n    }\n    return -1\n}\n```\n
['Hash Table', 'Go']