Class Solution
-
- All Implemented Interfaces:
public final class Solution3718 - Smallest Missing Multiple of K.
Easy
Given an integer array
numsand an integerk, return the smallest positive multiple ofkthat is missing fromnums.A multiple of
kis any positive integer divisible byk.Example 1:
Input: nums = 8,2,3,4,6, k = 2
Output: 10
Explanation:
The multiples of
k = 2are 2, 4, 6, 8, 10, 12... and the smallest multiple missing fromnumsis 10.Example 2:
Input: nums = 1,4,7,10,15, k = 5
Output: 5
Explanation:
The multiples of
k = 5are 5, 10, 15, 20... and the smallest multiple missing fromnumsis 5.Constraints:
1 <= nums.length <= 1001 <= nums[i] <= 1001 <= k <= 100
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final IntegermissingMultiple(IntArray nums, Integer k)-
-
Method Detail
-
missingMultiple
final Integer missingMultiple(IntArray nums, Integer k)
-
-
-
-