Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Not an issue
Reference solution appears to have bug when both hands have one or two pairs. I debugged my own solution quite exhaustively, and could not find mistakes.
I could submit after some trying and getting favourable random tests, and I could not figure out exactly what the reference solution is doing wrong ( or at all ).
So I might be wrong, but I doubt it. Marking as
Issue
because it probably is.Initial code is self-contradictory:
The comment is incorrect.
It's an elegance solution, but can be more efficient.
sum
is an expensive operation, and we can avoidsum
using slide window, which like a deque.Your solution is O(n^2), yet the one using slide window can be O(n).
duplicate
(if your language isn't available with this one, you should rather do it's translation than create a new one)
Do you know which language this was in?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Hi, I'm the original author of this Kata (Ruby version). Author of the haskell version didn't understand this Kata properly, and indeed added a DFS version instead of BFS.
I have learned haskell to fix this. I added a BFS solution and a correct buildTree (thanks to @nickie for providing one). Please take a look again.
Thanks,
Karol
I have shrinked test cases to 5 cards only. This makes kata more well-defined.
Random test says
Wiki says "In games where more than five cards are available to each player, the best five-card combination of those cards must be played", so my solution selects second hand as having a flush of
JC 8C 2C 5C 7C
.This looks interesting, but I'm struggling to understand the Poker rules.
The Wikipedia link shows 5-card hands and explains their ranking. But the tests seem to also test for 7-card hands. How do all those concepts translate? Is there a 3 pair, for example?
Also, the second big hand should probably read "8C 6C 5C JC 7C 9C 10C" (instead of "8C 4..") so that it is actually a straight.
Hand
can contain any number of cards", so random testing works correctlySorry, forgot to mention that if two hands are equal, first hand should be returned
betterHand function returns a Hand, so it is not clear what to do if hands are equal.
Loading more items...