import java.util.Arrays; public class Solution { public boolean IsContinuous(int [] numbers) { int joker = 0; Arrays.sort(numbers); for(int i = 0;i < 4;i ++){ if(numbers[i] == 0) { joker ++; } else if(numbers[i] == numbers[i + 1]){ return false; } } return numbers[4] - numbers[joker] < 5;
// int joker = 0; // Arrays.sort(numbers); // 数组排序 // for(int i = 0; i < 4; i++) { // if(numbers[i] == 0) joker++; // 统计大小王数量 // else if(numbers[i] == numbers[i + 1]) return false; // 若有重复,提前返回 false // } // return numbers[4] - numbers[joker] < 5;
}
}