要求:连续5张,0可以当任意
思路:
class Solution {
public:
bool isStraight(vector<int>& nums) {
vector<int> v(14,0);
int minn=14,maxn=-1;
for(int num:nums){
if(num==0)continue;
if(v[num]>0)return false;
else v[num]+=1;
if(num>maxn)maxn=num;
if(num<minn)minn=num;
}
return abs(maxn-minn)<5;
}
};