You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: solution/1700-1799/1742.Maximum Number of Balls in a Box/README_EN.md
+64-3
Original file line number
Diff line number
Diff line change
@@ -74,11 +74,11 @@ Box 10 has the most number of balls with 2 balls.
74
74
75
75
### Solution 1: Array + Simulation
76
76
77
-
Observing the data range of the problem, the maximum number of the ball does not exceed $10^5$, so the maximum value of the sum of each digit of the number is less than $50$. Therefore, we can directly create an array $cnt$ with a length of $50$ to count the number of each digit sum of each number.
77
+
Observing the problem's data range, the maximum number of balls does not exceed $10^5$, so the maximum sum of the digits of each number is less than $50$. Therefore, we can directly create an array $\textit{cnt}$ of length $50$ to count the number of occurrences of each digit sum.
78
78
79
-
The answer is the maximum value in the array $cnt$.
79
+
The answer is the maximum value in the array $\textit{cnt}$.
80
80
81
-
The time complexity is $O(n \times \log_{10}m)$. Here, $n = highLimit - lowLimit + 1$, and $m = highLimit$.
81
+
The time complexity is $O(n \times \log_{10}m)$. Here, $n = \textit{highLimit} - \textit{lowLimit} + 1$, and $m = \textit{highLimit}$.
82
82
83
83
<!-- tabs:start -->
84
84
@@ -170,6 +170,67 @@ function countBalls(lowLimit: number, highLimit: number): number {
0 commit comments