You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a non-negative integer <code>N</code>, find the largest number that is less than or equal to <code>N</code> with monotone increasing digits.
3
+
</p><p>
4
+
(Recall that an integer has <i>monotone increasing digits</i> if and only if each pair of adjacent digits <code>x</code> and <code>y</code> satisfy <code>x <= y</code>.)
5
+
</p><p>
6
+
7
+
</p><p><b>Example 1:</b><br>
8
+
</p><pre><b>Input:</b> N = 10
9
+
<b>Output:</b> 9
10
+
</pre>
11
+
<p></p>
12
+
13
+
<p><b>Example 2:</b><br>
14
+
</p><pre><b>Input:</b> N = 1234
15
+
<b>Output:</b> 1234
16
+
</pre>
17
+
<p></p>
18
+
19
+
<p><b>Example 3:</b><br>
20
+
</p><pre><b>Input:</b> N = 332
21
+
<b>Output:</b> 299
22
+
</pre>
23
+
<p></p>
24
+
25
+
<p><b>Note:</b>
26
+
<code>N</code> is an integer in the range <code>[0, 10^9]</code>.
0 commit comments