方法一:排序加遍历 class Solution { public boolean isStraight(int[] nums) { Arrays.sort(nums); int joker = 0; for(int i = 0; i<4; i++){ if(nums[i] == 0){joker+=1;} else if(nums[i] == nums[i+1]){ return false; } } return (nums[4] - nums[joker]) <5; } } 题解