class Solution:
def IsContinuous(self,numbers):
# write code here
if not numbers:
return False
numbers.sort()
n = numbers.count(0)
newNumbers = numbers[n:]
count = 0
for i in range(len(newNumbers) - 1):
if newNumbers[i+1] - newNumbers[i]>0:
count += (newNumbers[i+1] - newNumbers[i])
else:
return False
if count<=4:
return True
return False
扑克牌顺子
最新推荐文章于 2021-03-12 19:02:06 发布