how are you
[Assessment knowledge] How to read each number from the tens to higher digits of any number
class Solution {
public:
int monotoneIncreasingDigits(int N) {
if (N < 10) return N;
int k;
// 从十位开始向更高位遍历
for (k = 10; N / k > 0; k *= 10) {
// 高位比低位数值大
if (N / k % 10 > N / (k / 10) % 10)
N -= N % k + 1;
}
return N;
}
};