Problem
A number has monotone increasing digits if each digit is less than or equal to the digit after it (like 1234 or 1129). Return the largest number less than or equal to n with that property.
Example 1
- Input
- n = 10
- Output
- 9
Example 2
- Input
- n = 1234
- Output
- 1234
Example 3
- Input
- n = 332
- Output
- 299
Constraints
0 <= n <= 10^9