mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
35 lines
1.2 KiB
HTML
35 lines
1.2 KiB
HTML
<p>You are given two integers <code>n</code> and <code>t</code>. Return the <strong>smallest</strong> number greater than or equal to <code>n</code> such that the <strong>product of its digits</strong> is divisible by <code>t</code>.</p>
|
|
|
|
<p> </p>
|
|
<p><strong class="example">Example 1:</strong></p>
|
|
|
|
<div class="example-block">
|
|
<p><strong>Input:</strong> <span class="example-io">n = 10, t = 2</span></p>
|
|
|
|
<p><strong>Output:</strong> <span class="example-io">10</span></p>
|
|
|
|
<p><strong>Explanation:</strong></p>
|
|
|
|
<p>The digit product of 10 is 0, which is divisible by 2, making it the smallest number greater than or equal to 10 that satisfies the condition.</p>
|
|
</div>
|
|
|
|
<p><strong class="example">Example 2:</strong></p>
|
|
|
|
<div class="example-block">
|
|
<p><strong>Input:</strong> <span class="example-io">n = 15, t = 3</span></p>
|
|
|
|
<p><strong>Output:</strong> <span class="example-io">16</span></p>
|
|
|
|
<p><strong>Explanation:</strong></p>
|
|
|
|
<p>The digit product of 16 is 6, which is divisible by 3, making it the smallest number greater than or equal to 15 that satisfies the condition.</p>
|
|
</div>
|
|
|
|
<p> </p>
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>1 <= n <= 100</code></li>
|
|
<li><code>1 <= t <= 10</code></li>
|
|
</ul>
|