题解 | #扑克牌顺子#
扑克牌顺子
https://www.nowcoder.com/practice/762836f4d43d43ca9deb273b3de8e1f4
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param numbers int整型一维数组 # @return bool布尔型 # class Solution: def IsContinuous(self , numbers: List[int]) -> bool: # write code here numbers.sort() n = numbers.count(0) newlist = numbers[n:] if len(newlist)!=len(set(newlist)): return False else: if newlist[-1]-newlist[0]+1 ==len(newlist): return True if newlist[-1]-newlist[0]+1 ==len(newlist)+n: return True return False