[Community Puzzle] Texas Holdem

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Hi. I do not understand this expected test output:

Test 7 input is:

Player 1: 5H 2D
Player 2: 6D QH
Community: 5C 5S AH 5D 9C

I would have thought that Player 1 would use the three 5s from the Community rack to create the four of a kind meld (5H,5C,5S,5D) with the remaining 2D being a kicker. My code outputs

Found:
1 FOUR_OF_A_KIND 55552

Expected:
1 FOUR_OF_A_KIND 5555A

Could someone please explain why the A is counted, not the 2? The previous validators work fine for me.

The statement says:

• values (descending order): A, K, Q, J, T, 9, 8, 7, 6, 5, 4, 3, 2

and

The highest kicker is considered first, then the next, and so on.

As A is higher in value than 2, A is chosen as the kicker in this case.


The previous validators work fine for me.

Would you please specify which ones and explain whether the selection of kickers there works differently than my explanation above?

Also, I was confused by your original post, because you mentioned “Validator 7” instead of “Test 7”. Bear in mind that tests are visible and validators are invisible for CodinGame puzzles.

1 Like

Sorry, I meant test cases not validator case. My confusion was that I thought the best 5-card combination had to include both of the cards from the player’s hole. I had assumed I knew the rules for texas hold-em, but I was clearly mistaken (and had not read that part of the statement carefully enough). Thanks for the clarification.

1 Like