@@ -37,13 +37,13 @@ tags:
37
37
<pre >
38
38
<strong >Input:</strong > s = " ; 11111222223" ; , k = 3
39
39
<strong >Output:</strong > " ; 135" ;
40
- <strong >Explanation:</strong >
40
+ <strong >Explanation:</strong >
41
41
- For the first round, we divide s into groups of size 3: " ; 111" ; , " ; 112" ; , " ; 222" ; , and " ; 23" ; .
42
- Then we calculate the digit sum of each group: 1 + 1 + 1 = 3, 1 + 1 + 2 = 4, 2 + 2 + 2 = 6, and 2 + 3 = 5.
42
+ Then we calculate the digit sum of each group: 1 + 1 + 1 = 3, 1 + 1 + 2 = 4, 2 + 2 + 2 = 6, and 2 + 3 = 5.
43
43
  ; So, s becomes " ; 3" ; + " ; 4" ; + " ; 6" ; + " ; 5" ; = " ; 3465" ; after the first round.
44
44
- For the second round, we divide s into " ; 346" ; and " ; 5" ; .
45
-   ; Then we calculate the digit sum of each group: 3 + 4 + 6 = 13, 5 = 5.
46
-   ; So, s becomes " ; 13" ; + " ; 5" ; = " ; 135" ; after second round.
45
+   ; Then we calculate the digit sum of each group: 3 + 4 + 6 = 13, 5 = 5.
46
+   ; So, s becomes " ; 13" ; + " ; 5" ; = " ; 135" ; after second round.
47
47
Now, s.length < ; = k, so we return " ; 135" ; as the answer.
48
48
</pre >
49
49
@@ -52,9 +52,9 @@ Now, s.length <= k, so we return "135" as the answer.
52
52
<pre >
53
53
<strong >Input:</strong > s = " ; 00000000" ; , k = 3
54
54
<strong >Output:</strong > " ; 000" ;
55
- <strong >Explanation:</strong >
55
+ <strong >Explanation:</strong >
56
56
We divide s into " ; 000" ; , " ; 000" ; , and " ; 00" ; .
57
- Then we calculate the digit sum of each group: 0 + 0 + 0 = 0, 0 + 0 + 0 = 0, and 0 + 0 = 0.
57
+ Then we calculate the digit sum of each group: 0 + 0 + 0 = 0, 0 + 0 + 0 = 0, and 0 + 0 = 0.
58
58
s becomes " ; 0" ; + " ; 0" ; + " ; 0" ; = " ; 000" ; , whose length is equal to k, so we return " ; 000" ; .
59
59
</pre >
60
60
0 commit comments