注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
地里的两道原题, 分享一下python的code:
1. Smallest Range II (LC 910) :
class Solution(object):
def smallestRangeII(self, A, K):
A.sort()
mi, ma = A[0], A[-1]
ans = ma - mi
for i in range(len(A) - 1):
a, y1, x2, y2, x, y)
# Check if sum of A1, A2 and A3
# is same as A
if(A == A1 + A2 + A3):
return True
else:
return False |