Tap here to switch tabs
Problem
Submissions

Problem: Monotone Increasing Digits

med
30 min
Try to solve the Monotone Increasing Digits problem.

Statement

An integer is considered to have monotone increasing digits if each digit is less than or equal to the digit immediately following it.

Given an integer n, return the largest integer less than or equal to n that has monotone increasing digits.

Constraints:

  • 0≤0 \leq n ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Monotone Increasing Digits

med
30 min
Try to solve the Monotone Increasing Digits problem.

Statement

An integer is considered to have monotone increasing digits if each digit is less than or equal to the digit immediately following it.

Given an integer n, return the largest integer less than or equal to n that has monotone increasing digits.

Constraints:

  • 0≤0 \leq n ≤109\leq 10^9