|
| 1 | +<h2><a href="https://leetcode.com/problems/smallest-missing-multiple-of-k">4080. Smallest Missing Multiple of K</a></h2><h3>Easy</h3><hr><p>Given an integer array <code>nums</code> and an integer <code>k</code>, return the <strong>smallest positive multiple</strong> of <code>k</code> that is <strong>missing</strong> from <code>nums</code>.</p> |
| 2 | + |
| 3 | +<p>A <strong>multiple</strong> of <code>k</code> is any positive integer divisible by <code>k</code>.</p> |
| 4 | + |
| 5 | +<p> </p> |
| 6 | +<p><strong class="example">Example 1:</strong></p> |
| 7 | + |
| 8 | +<div class="example-block"> |
| 9 | +<p><strong>Input:</strong> <span class="example-io">nums = [8,2,3,4,6], k = 2</span></p> |
| 10 | + |
| 11 | +<p><strong>Output:</strong> <span class="example-io">10</span></p> |
| 12 | + |
| 13 | +<p><strong>Explanation:</strong></p> |
| 14 | + |
| 15 | +<p>The multiples of <code>k = 2</code> are 2, 4, 6, 8, 10, 12... and the smallest multiple missing from <code>nums</code> is 10.</p> |
| 16 | +</div> |
| 17 | + |
| 18 | +<p><strong class="example">Example 2:</strong></p> |
| 19 | + |
| 20 | +<div class="example-block"> |
| 21 | +<p><strong>Input:</strong> <span class="example-io">nums = [1,4,7,10,15], k = 5</span></p> |
| 22 | + |
| 23 | +<p><strong>Output:</strong> <span class="example-io">5</span></p> |
| 24 | + |
| 25 | +<p><strong>Explanation:</strong></p> |
| 26 | + |
| 27 | +<p>The multiples of <code>k = 5</code> are 5, 10, 15, 20... and the smallest multiple missing from <code>nums</code> is 5.</p> |
| 28 | +</div> |
| 29 | + |
| 30 | +<p> </p> |
| 31 | +<p><strong>Constraints:</strong></p> |
| 32 | + |
| 33 | +<ul> |
| 34 | + <li><code>1 <= nums.length <= 100</code></li> |
| 35 | + <li><code>1 <= nums[i] <= 100</code></li> |
| 36 | + <li><code>1 <= k <= 100</code></li> |
| 37 | +</ul> |
0 commit comments