好理解点,就是废手
扑克牌顺子
http://www.nowcoder.com/questionTerminal/762836f4d43d43ca9deb273b3de8e1f4
import java.util.Arrays;
public class Solution {
public boolean isContinuous(int [] numbers) {
if(numbers.length<=4) return false;
Arrays.sort(numbers);
int cout=0;
for(int i=0;i<=numbers.length-1;i++){
if(i+1<=numbers.length-1&&numbers[i]==numbers[i+1]&&numbers[i]!=0){
return false;
}
if(numbers[i]==0) cout++;
}
if(cout==4) return true;
if(cout==3){
if(numbers[4]-numbers[3]<=4) return true;
}
if(cout==2){
if(numbers[4]-numbers[2]<=4) return true;
}
if(cout==1){
if(numbers[4]-numbers[1]<=4) return true;
}
if(cout==0){
if(numbers[4]-numbers[3]==1&&numbers[4]-numbers[2]==2&&numbers[4]-numbers[1]==3&&numbers[4]-numbers[0]==4)
return true;}
return false;}
}