A regional distribution center processes parcels whose tracking numbers are exactly the consecutive integers from low to high, inclusive. An automated sorter routes each parcel into the bin whose number equals the sum of the decimal digits of that parcel's tracking number (for instance, tracking number 1204 is routed to bin 1+2+0+4 = 7). Given low and high, determine how many parcels end up in the single busiest bin -- the bin that receives the most parcels.
A single line containing two integers low and high, separated by whitespace.
A single integer: the maximum number of parcels routed into any one bin.
Example 1
Input
1 10
Expected
2
Explanation
Tracking numbers 1 through 10 are routed by digit sum. Bin 1 receives both parcel 1 (digit sum 1) and parcel 10 (digit sum 1+0=1), for a total of 2 parcels; every other bin from 2 through 9 receives exactly one parcel. The busiest bin therefore holds 2 parcels.
Example 2
Input
1 21
Expected
3
Explanation
Bin 2 receives parcels 2, 11 (1+1=2), and 20 (2+0=2) -- 3 parcels. Bin 3 receives parcels 3, 12 (1+2=3), and 21 (2+1=3) -- also 3 parcels. No other bin in the range 1..21 reaches 3, so the busiest bin holds 3 parcels.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →