908. Smallest Range I ¶ Time: Space: C++JavaPython 1 2 3 4 5 6 7 8class Solution { public: int smallestRangeI(vector<int>& nums, int k) { const int mx = ranges::max(nums); const int mn = ranges::min(nums); return max(0, mx - mn - 2 * k); } }; 1 2 3 4 5 6 7class Solution { public int smallestRangeI(int[] nums, int k) { final int mx = Arrays.stream(nums).max().getAsInt(); final int mn = Arrays.stream(nums).min().getAsInt(); return Math.max(0, mx - mn - 2 * k); } } 1 2 3class Solution: def smallestRangeI(self, nums: list[int], k: int) -> int: return max(0, max(nums) - min(nums) - 2 * k)