Class Solution

  • All Implemented Interfaces:

    
    public final class Solution
    
                        

    3718 - Smallest Missing Multiple of K.

    Easy

    Given an integer array nums and an integer k, return the smallest positive multiple of k that is missing from nums.

    A multiple of k is any positive integer divisible by k.

    Example 1:

    Input: nums = 8,2,3,4,6, k = 2

    Output: 10

    Explanation:

    The multiples of k = 2 are 2, 4, 6, 8, 10, 12... and the smallest multiple missing from nums is 10.

    Example 2:

    Input: nums = 1,4,7,10,15, k = 5

    Output: 5

    Explanation:

    The multiples of k = 5 are 5, 10, 15, 20... and the smallest multiple missing from nums is 5.

    Constraints:

    • 1 <= nums.length <= 100

    • 1 <= nums[i] <= 100

    • 1 <= k <= 100

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Solution()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Integer missingMultiple(IntArray nums, Integer k)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait