738. Monotone Increasing Digits Medium
1/**
2 * [738] Monotone Increasing Digits
3 *
4 * An integer has monotone increasing digits if and only if each pair of adjacent digits x and y satisfy x <= y.
5 * Given an integer n, return the largest number that is less than or equal to n with monotone increasing digits.
6 *
7 * Example 1:
8 *
9 * Input: n = 10
10 * Output: 9
11 *
12 * Example 2:
13 *
14 * Input: n = 1234
15 * Output: 1234
16 *
17 * Example 3:
18 *
19 * Input: n = 332
20 * Output: 299
21 *
22 *
23 * Constraints:
24 *
25 * 0 <= n <= 10^9
26 *
27 */
28pub struct Solution {}
29
30// problem: https://leetcode.com/problems/monotone-increasing-digits/
31// discuss: https://leetcode.com/problems/monotone-increasing-digits/discuss/?currentPage=1&orderBy=most_votes&query=
32
33// submission codes start here
34
35impl Solution {
36 pub fn monotone_increasing_digits(n: i32) -> i32 {
37 0
38 }
39}
40
41// submission codes end
42
43#[cfg(test)]
44mod tests {
45 use super::*;
46
47 #[test]
48 fn test_738() {
49 }
50}
51
Back
© 2025 bowen.ge All Rights Reserved.