题解 | #扑克牌顺子#
扑克牌顺子
http://www.nowcoder.com/practice/762836f4d43d43ca9deb273b3de8e1f4
import java.lang.*; import java.util.*; public class Solution { public boolean IsContinuous(int [] numbers) { HashSet<Integer> set = new HashSet<>(); int max=0; int min=14; for(int i=0;i<numbers.length;i++){ if(numbers[i]==0) continue; max=Math.max(max,numbers[i]); min=Math.min(min,numbers[i]); if(set.contains(numbers[i])) return false; set.add(numbers[i]); } return max-min<5; } }