2025-08-01 13:02:30 +0000 UTC
Smallest Range I
Categories:
Links
Code
class Solution:
def smallestRangeI(self, nums: List[int], k: int) -> int:
min_num, max_num = min(nums), max(nums)
diff = max_num - min_num
res = max(diff - 2 * k, 0)
return res