2019-11-11 LeetCode in Rust LeetCode 1015. Smallest Integer Divisible by K Problem Statement impl Solution { pub fn smallest_repunit_div_by_k(k: i32) -> i32 { let (mut cur, mut ans) = (1, 1); if k % 2 == 0 || k % 5 == 0 { return -1; } while ans <= k { if cur % k == 0 { return ans; } cur = (cur * 10 + 1) % k; ans += 1; } return ans; }} Newer LeetCode 980. Unique Paths III Older LeetCode 1016. Binary String With Substrings Representing 1 To N