1 class Solution: 2 def numMovesStones(self, a: int, b: int, c: int) -> 'List[int]': 3 l = list() 4 l.append(a) 5 l.append(b) 6 l.append(c) 7 l = sorted(l) 8 9 r = list() 10 minval = 0 11 maxval = 0 12 13 if l[1] - l[0] == 1 and l[2] - l[1] == 1: 14 return [minval,maxval] 15 elif (l[1] - l[0]==1) or (l[2]-l[1]==1) or (l[1] - l[0] == 2) or (l[2] - l[1] == 2): 16 minval = 1 17 else: 18 minval = 2 19 20 maxval += l[1] - l[0] - 1 21 maxval += l[2] - l[1] - 1 22 23 return [minval,maxval]
这道题出的有点不知所云。