We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b6f0f97 commit 8456205Copy full SHA for 8456205
scripts/algorithms/S/Smallest Range I/Smallest Range I.py
@@ -1,4 +1,7 @@
1
-# Runtime: 145 ms (Top 75.66%) | Memory: 15.5 MB (Top 23.89%)
+// Runtime: 156 ms (Top 5.06%) | Memory: 18.40 MB (Top 7.47%)
2
+
3
class Solution:
- def smallestRangeI(self, nums: List[int], k: int) -> int:
4
- return max(0, max(nums)-min(nums)-2*k)
+ def smallestRangeI(self, A: List[int], K: int) -> int:
5
+ maxi = max(A)
6
+ mini = min(A)
7
+ return max(0, maxi-K-mini-K)
0 commit comments