1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/单调递增的数字 [monotone-increasing-digits].html
2022-03-29 12:43:11 +08:00

35 lines
828 B
HTML

<p>当且仅当每个相邻位数上的数字&nbsp;<code>x</code>&nbsp;&nbsp;<code>y</code>&nbsp;满足&nbsp;<code>x &lt;= y</code>&nbsp;时,我们称这个整数是<strong>单调递增</strong>的。</p>
<p>给定一个整数 <code>n</code> ,返回 <em>小于或等于 <code>n</code> 的最大数字,且数字呈 <strong>单调递增</strong></em></p>
<p>&nbsp;</p>
<p><strong>示例 1:</strong></p>
<pre>
<strong>输入:</strong> n = 10
<strong>输出:</strong> 9
</pre>
<p><strong>示例 2:</strong></p>
<pre>
<strong>输入:</strong> n = 1234
<strong>输出:</strong> 1234
</pre>
<p><strong>示例 3:</strong></p>
<pre>
<strong>输入:</strong> n = 332
<strong>输出:</strong> 299
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 &lt;= n &lt;= 10<sup>9</sup></code></li>
</ul>