链接:https://leetcode-cn.com/problems/bu-ke-pai-zhong-de-shun-zi-lcof/
代码
class Solution {
public:
bool isStraight(vector<int>& nums) {
if (nums.empty()) return false;
sort(nums.begin(), nums.end());
int k = 0;
while (!nums[k]) k++;
for (int i = k + 1; i < nums.size(); ++i) {
if (nums[i] == nums[i - 1]) return false;
}
return nums.back() - nums[k] <= 4;
}
};