首页 > 代码库 > 【剑指offer】:Q44:扑克牌的顺子

【剑指offer】:Q44:扑克牌的顺子

def IsContinuous(seq, num = 5):
	zeros = 0; d = 0

	seq = sorted(seq)
	for i in range(num - 1):
		if seq[i] == 0:
			zeros += 1
			continue
		if seq[i] == seq[i + 1]:
			return False
		d += seq[i + 1] - seq[i] - 1

	return zeros >= d