LeetCode Entry

3718. Smallest Missing Multiple of K

25.08.2026 easy 2026 kotlin rust

Smallest k-multiplier not in an array

3718. Smallest Missing Multiple of K easy substack youtube

https://dmitrysamoylenko.com/leetcode/

25.08.2026.webp

Join me on Telegram

https://t.me/leetcode_daily_unstoppable/1462

Problem TLDR

Smallest k-multiplier not in an array

Intuition

Brute-force

Approach

  • what is the upper bound?

Complexity

  • Time complexity: \(O(n^2)\)

  • Space complexity: \(O(1)\)

Code

    fun missingMultiple(n: IntArray, k: Int) =
    (k..200 step k).find { it !in n }
    pub fn missing_multiple(n: Vec<i32>, k: i32) -> i32 {
        (1..).find(|i| !n.contains(&(i * k))).unwrap() * k
    }

Comments