Watch 10 video solutions for Find the Maximum Achievable Number, a easy level problem involving Math. This walkthrough by Greg Hogg has 71,069 views views. Want to try solving it yourself? Practice on FleetCode or read the detailed text solution.
Given two integers, num and t. A number is achievable if it can become equal to num after applying the following operation:
1, and simultaneously increase or decrease num by 1.Return the maximum achievable number after applying the operation at most t times.
Example 1:
Input: num = 4, t = 1
Output: 6
Explanation:
Apply the following operation once to make the maximum achievable number equal to num:
num by 1.Example 2:
Input: num = 3, t = 2
Output: 7
Explanation:
Apply the following operation twice to make the maximum achievable number equal to num:
num by 1.
Constraints:
1 <= num, t <= 50