3718. Smallest Missing Multiple of K Easy
1/**
2 * [3718] Smallest Missing Multiple of K
3 *
4 * Given an integer array nums and an integer k, return the smallest positive multiple of k that is missing from nums.
5 * A multiple of k is any positive integer divisible by k.
6 *
7 * <strong class="example">Example 1:
8 * <div class="example-block">
9 * Input: <span class="example-io">nums = [8,2,3,4,6], k = 2</span>
10 * Output: <span class="example-io">10</span>
11 * Explanation:
12 * The multiples of k = 2 are 2, 4, 6, 8, 10, 12... and the smallest multiple missing from nums is 10.
13 * </div>
14 * <strong class="example">Example 2:
15 * <div class="example-block">
16 * Input: <span class="example-io">nums = [1,4,7,10,15], k = 5</span>
17 * Output: <span class="example-io">5</span>
18 * Explanation:
19 * The multiples of k = 5 are 5, 10, 15, 20... and the smallest multiple missing from nums is 5.
20 * </div>
21 *
22 * Constraints:
23 *
24 * 1 <= nums.length <= 100
25 * 1 <= nums[i] <= 100
26 * 1 <= k <= 100
27 *
28 */
29pub struct Solution {}
30
31// problem: https://leetcode.com/problems/smallest-missing-multiple-of-k/
32// discuss: https://leetcode.com/problems/smallest-missing-multiple-of-k/discuss/?currentPage=1&orderBy=most_votes&query=
33
34// submission codes start here
35
36impl Solution {
37 pub fn missing_multiple(nums: Vec<i32>, k: i32) -> i32 {
38 0
39 }
40}
41
42// submission codes end
43
44#[cfg(test)]
45mod tests {
46 use super::*;
47
48 #[test]
49 fn test_3718() {
50 }
51}
52Back
© 2026 bowen.ge All Rights Reserved.