Company: Hsbc_24oct
Difficulty: medium
Maximize Three-Digit Value Problem Description Write a function solution that, given a three-digit integer N and an integer K , returns the maximum possible three-digit value that can be obtained by performing at most K increases by 1 of any digit in N . Examples Example 1: Input: N = 512, K = 10 Output: 972 Explanation: The result can be obtained by increasing the first digit of N four times (5 -> 9) and the second digit six times (1 -> 7). Total increases: 4 + 6 = 10. Example 2: Input: N = 191, K = 4 Output: 591 Explanation: The result can be obtained by increasing the first digit of N four times (1 -> 5). Total increases: 4. Example 3: Input: N = 285, K = 20 Output: 999 Explanation: The result can be obtained by increasing the first digit of N seven times (2 -> 9), the second digit once (8 -> 9), and the third digit four times (5 -> 9). Total increases: 7 + 1 + 4 = 12. Since K=20, 12 increases is within the limit. Constraints N is an integer within the range [100..999]. K is an inte