Class Solution
java.lang.Object
g0701_0800.s0738_monotone_increasing_digits.Solution
738 - Monotone Increasing Digits.<p>Medium</p>
<p>An integer has <strong>monotone increasing digits</strong> if and only if each pair of adjacent digits <code>x</code> and <code>y</code> satisfy <code>x <= y</code>.</p>
<p>Given an integer <code>n</code>, return <em>the largest number that is less than or equal to</em> <code>n</code> <em>with <strong>monotone increasing digits</strong></em>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> n = 10</p>
<p><strong>Output:</strong> 9</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> n = 1234</p>
<p><strong>Output:</strong> 1234</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> n = 332</p>
<p><strong>Output:</strong> 299</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>0 <= n <= 10<sup>9</sup></code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
monotoneIncreasingDigits
public int monotoneIncreasingDigits(int n)
-