Math, asked by kshitijnimje2998, 9 months ago

You are given two numbers a and b. Determine the sum s for which maximum numbers between a and b (inclusive) have their sum of digits equal to s and also the number of times this sum s occurs. Note: brute force won't pass. A,b<=1e18.

Answers

Answered by Anonymous
6

Answer:

Input : x1 = 645 x2 = 666

Output : Minimum Sum: 1100 (545 + 555)

Maximum Sum: 1312 (646 + 666)

Input: x1 = 5466 x2 = 4555

Output: Minimum sum: 10010

Maximum Sum: 11132

Similar questions