题解 | #扑克牌顺子#
这个怎末优化
import java.util.HashMap; import java.util.*; import java.lang.*; public class Solution { public boolean IsContinuous(int [] numbers) { int max1=0; int min1=15; Map<Integer,Integer> map=new HashMap<Integer,Integer>(); for(int i=0;i<5;i++){ if(numbers[i]==0){ continue; }else{ if(numbers[i]>max1){ max1=numbers[i]; } if(numbers[i]<min1){ min1=numbers[i]; } } if(map.containsKey(numbers[i])){ return false; }else { map.put(numbers[i],1); } } if((max1-min1)>4){ return false; } return true; } }