mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-23 22:08:58 +08:00
38 lines
1.3 KiB
HTML
38 lines
1.3 KiB
HTML
<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>
|
|
|
|
<p>A <strong>multiple</strong> of <code>k</code> is any positive integer divisible by <code>k</code>.</p>
|
|
|
|
<p> </p>
|
|
<p><strong class="example">Example 1:</strong></p>
|
|
|
|
<div class="example-block">
|
|
<p><strong>Input:</strong> <span class="example-io">nums = [8,2,3,4,6], k = 2</span></p>
|
|
|
|
<p><strong>Output:</strong> <span class="example-io">10</span></p>
|
|
|
|
<p><strong>Explanation:</strong></p>
|
|
|
|
<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>
|
|
</div>
|
|
|
|
<p><strong class="example">Example 2:</strong></p>
|
|
|
|
<div class="example-block">
|
|
<p><strong>Input:</strong> <span class="example-io">nums = [1,4,7,10,15], k = 5</span></p>
|
|
|
|
<p><strong>Output:</strong> <span class="example-io">5</span></p>
|
|
|
|
<p><strong>Explanation:</strong></p>
|
|
|
|
<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>
|
|
</div>
|
|
|
|
<p> </p>
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>1 <= nums.length <= 100</code></li>
|
|
<li><code>1 <= nums[i] <= 100</code></li>
|
|
<li><code>1 <= k <= 100</code></li>
|
|
</ul>
|