Problem Statement
Find the sum of all the digits in all the integers between lowerBound and upperBound, inclusive.
Definition
- Class:
- SumThemAll
- Method:
- getSum
- Parameters:
- int, int
- Returns:
- long
- Method signature:
- long getSum(int lowerBound, int upperBound)
- (be sure your method is public)
Constraints
- upperBound will be between 0 and 2,000,000,000, inclusive.
- lowerBound will be between 0 and upperBound, inclusive.
Examples
0
3
Returns: 6
0 + 1 + 2 + 3 = 610
14
Returns: 15
(1+0) + (1+1) + (1+2) + (1+3) + (1+4) = 150
0
Returns: 0
14
53
Returns: 296
24660
308357171
Returns: 11379854844