← 返回 roblox 的题目列表Maximum Number of Balls in a Box (LeetCode 1742)
类型:qbank
Count balls by digit-sum box number and return the maximum number of balls in any box.
Examples
Example 1:
Input: lowLimit = 1, highLimit = 10
Output: 2
Explanation:
Box 1 receives both ball 1 (1) and ball 10 (1+0), so the most-filled box has 2 balls.
Example 2:
Input: lowLimit = 5, highLimit = 15
Output: 2
Explanation:
Box 6 has balls 6 and 15; no other box has more than 1.
Example 3:
Input: lowLimit = 19, highLimit = 28
Output: 2
Explanation:
Balls 19 (1+9=10) and 28 (2+8=10) both land in box 10; every other box has 1 ball.
Constraints
1 <= lowLimit <= highLimit <= 10^5