Skip to content

Commit

Permalink
最小范围 I
Browse files Browse the repository at this point in the history
  • Loading branch information
rinwf committed Sep 23, 2018
1 parent 0f7384c commit a0285ec
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lc908. Smallest Range I.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Solution:
def smallestRangeI(self, A, K):
"""
:type A: List[int]
:type K: int
:rtype: int
"""
res = max(A) - min(A) - 2*K
return res if res > 0 else 0


A = [1,3,6]
K = 3
s = Solution()
print(s.smallestRangeI(A, K))

0 comments on commit a0285ec

Please sign in to comment.