【LeetCode】2347. 最好的扑克手牌
class Solution {
public:
string bestHand(vector<int>& ranks, vector<char>& suits) {
int sameNum = 0;
if (count(suits.begin(),suits.end(),suits[0]) == 5) return "Flush";
for (int i = 0; i < ranks.size(); i++)
{
int ct = count(ranks.begin(),ranks.end(),ranks[i]);
sameNum = sameNum < ct ? ct : sameNum;
}
switch(sameNum){
case 5:;
case 4:;
case 3: return "Three of a Kind";
case 2: return "Pair";
case 1: return "High Card";
}
return "";
}
};