2.7 KiB
2.7 KiB
id, challengeType, title, forumTopicId
id | challengeType | title | forumTopicId |
---|---|---|---|
5900f3a21000cf542c50feb5 | 5 | Problem 54: Poker hands | 302165 |
Description
Hand | Player 1 | Player 2 | Winner |
---|---|---|---|
1 | 5H 5C 6S 7S KD Pair of Fives |
2C 3S 8S 8D TD Pair of Eights |
Player 2 |
2 | 5D 8C 9S JS AC Highest card Ace |
2C 5C 7D 8S QH Highest card Queen |
Player 1 |
3 | 2D 9C AS AH AC Three Aces |
3D 6D 7D TD QD Flush with Diamonds |
Player 2 |
4 | 4D 6S 9H QH QC Pair of Queens Highest card Nine |
3D 6D 7H QD QS Pair of Queens Highest card Seven |
Player 1 |
5 | 2H 2D 4C 4D 4S Full House with Three Fours |
3C 3D 3S 9S 9D Full House with Three Threes |
Player 1 |
The file, poker.txt, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all hands are valid (no invalid characters or repeated cards), each player's hand is in no specific order, and in each hand there is a clear winner. How many hands does Player 1 win?
Instructions
Tests
tests:
- text: <code>euler54()</code> should return 376.
testString: assert.strictEqual(euler54(), 376);
Challenge Seed
function euler54() {
// Good luck!
return true;
}
euler54();
Solution
// solution required