2347. 最好的扑克手牌

给你一个整数数组 ranks 和一个字符数组 suit 。你有 5 张扑克牌,第 i 张牌大小为 ranks[i] ,花色为 suits[i] 。

下述是从好到坏你可能持有的 手牌类型 :

来源:力扣(LeetCode)
链接:https://leetcode.cn/problems/best-poker-hand
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。

1
2
3
4
5
6
7
8
9
10
11
class Solution:
def bestHand(self, ranks: List[int], suits: List[str]) -> str:
dic = dict(Counter(ranks))
if len(set(suits)) == 1:
return "Flush"
elif dic[max(dic,key=dic.get)] >= 3:
return "Three of a Kind"
elif len(set(ranks)) <= 4:
return "Pair"
elif len(set(ranks)) == 5:
return "High Card"