2347. Best Poker Hand
On This Page
class Solution:
def bestHand(self, ranks: List[int], suits: List[str]) -> str:
# if len(set(suits)) == 1:
if all(a == b for a, b in pairwise(suits)):
return 'Flush'
cnt = Counter(ranks)
if any(v >= 3 for v in cnt.values()):
return 'Three of a Kind'
if any(v == 2 for v in cnt.values()):
return 'Pair'
return 'High Card'