https://leetcode.com/problems/find-the-maximum-achievable-number/description/
- LeetCode
Can you solve this real interview question? - You are given two integers, num and t. An integer x is called achievable if it can become equal to num after applying the following operation no more than t times: * Increase or decrease x by 1, and simultaneou
leetcode.com
1
2
3
|
class Solution:
def theMaximumAchievableX(self, num: int, t: int) -> int:
return num + t*2
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 2798. Number of Employees Who Met the Target (0) | 2023.08.04 |
---|---|
leetcode 2744. Find Maximum Number of String Pairs (0) | 2023.07.13 |
leetcode 2739. Total Distance Traveled (0) | 2023.07.07 |
leetcode 2651. Calculate Delayed Arrival Time (0) | 2023.07.06 |
leetcode 2544. Alternating Digit Sum (0) | 2023.07.03 |
댓글