We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 98827c1 commit 6b38053Copy full SHA for 6b38053
problems/0738.单调递增的数字.md
@@ -392,6 +392,30 @@ impl Solution {
392
}
393
394
```
395
+### C#
396
+```csharp
397
+public class Solution
398
+{
399
+ public int MonotoneIncreasingDigits(int n)
400
+ {
401
+ char[] s = n.ToString().ToCharArray();
402
+ int flag = s.Length;
403
+ for (int i = s.Length - 1; i > 0; i--)
404
405
+ if (s[i - 1] > s[i])
406
407
+ flag = i;
408
+ s[i - 1]--;
409
+ }
410
411
+ for (int i = flag; i < s.Length; i++)
412
413
+ s[i] = '9';
414
415
+ return int.Parse(new string(s));
416
417
+}
418
+```
419
420
<p align="center">
421
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
0 commit comments