最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

LeetCode 2347. Best Poker Hand

2023-04-27 12:28 作者:您是打尖兒還是住店呢  | 我要投稿

You are given an integer array?ranks?and a character array?suits. You have?5?cards where the?ith?card has a rank of?ranks[i]?and a suit of?suits[i].

The following are the types of?poker hands?you can make from best to worst:

  1. "Flush": Five cards of the same suit.

  2. "Three of a Kind": Three cards of the same rank.

  3. "Pair": Two cards of the same rank.

  4. "High Card": Any single card.

Return?a string representing the?best?type of?poker hand?you can make with the given cards.

Note?that the return values are?case-sensitive.

?

Example 1:

Input:?ranks = [13,2,3,1,9], suits = ["a","a","a","a","a"]

Output:?"Flush"

Explanation:?The hand with all the cards consists of 5 cards with the same suit, so we have a?"Flush".

Example 2:

Input:?ranks = [4,4,2,4,4], suits = ["d","a","a","b","c"]

Output:?"Three of a Kind"

Explanation:?The hand with the first, second, and fourth card consists of 3 cards with the?same rank, so we have a "Three of a Kind". Note that we could also make a "Pair" hand but?"Three of a Kind" is a better hand. Also note that other cards could be used to make the?"Three of a Kind" hand.

Example 3:

Input:?ranks = [10,10,2,12,9], suits = ["a","b","c","a","d"]

Output:?"Pair"

Explanation:?The hand?with the first and second card consists of 2 cards with the same rank,?so we have a "Pair". Note that we cannot make a "Flush" or a "Three of a Kind".

easy題目,判斷涉及的3種類型,返回即可;

?

Constraints:

  • ranks.length == suits.length == 5

  • 1 <= ranks[i] <= 13

  • 'a' <= suits[i] <= 'd'

  • No two cards have the same rank and suit.

Runtime:?6 ms, faster than?5.06%?of?Java?online submissions for?Best Poker Hand.

Memory Usage:?40.9 MB, less than?5.45%?of?Java?online submissions for?Best Poker Hand.


LeetCode 2347. Best Poker Hand的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
贵南县| 大新县| 涟水县| 高雄市| 新兴县| 织金县| 呼玛县| 页游| 柳林县| 巴楚县| 南乐县| 明光市| 鹤峰县| 淮阳县| 太谷县| 遵化市| 高平市| 苍溪县| 温州市| 揭西县| 静海县| 吉林市| 新密市| 黄陵县| 渝北区| 光泽县| 宁南县| 裕民县| 叙永县| 股票| 潮州市| 新闻| 瑞安市| 榕江县| 普格县| 西平县| 姜堰市| 鄂托克前旗| 昔阳县| 舞钢市| 河池市|