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.
For input {3,2,2,3,2,1,1,2,3,3,2,2,5,1,2,2,4,3,3,2,1,2,2,4} my algorithm produces valid solution
[ [ 2, 4, 1, 3, 5, 6 ], [ 1, 6, 3, 2, 4, 5 ], [ 4, 1, 6, 5, 2, 3 ], [ 6, 5, 2, 1, 3, 4 ], [ 5, 3, 4, 6, 1, 2 ], [ 3, 2, 5, 4, 6, 1 ] ]
yet the test expect
[ [ 2, 1, 4, 3, 5, 6 ], [ 1, 6, 3, 2, 4, 5 ], [ 4, 3, 6, 5, 1, 2 ], [ 6, 5, 2, 1, 3, 4 ], [ 5, 4, 1, 6, 2, 3 ], [ 3, 2, 5, 4, 6, 1 ] ]
and thus fails.
Problem with the tests is that there might be more than valid solution!
C++: For input {2,2,1,3,2,2,3,1,1,2,2,3,3,2,1,3} my algorithm produces (valid) solution {{1,3,4,2},{4,2,1,3},{3,4,2,1},{2,1,3,4}} yet the test says it's wrong.
for input {2,2,1,3,2,2,3,1,1,2,2,3,3,2,1,3} my algorithm produces valid solution {{1,3,4,2},{4,2,1,3},{3,4,2,1},{2,1,3,4}}
yet the test says it's wrong.
Enjoyable coding challenge, congratulations.
For what it's worth, from my perspective I thought it was pretty clear. I wonder what you think is poorly explained?
Had to make a web app so that I could visualize & interact with the problem, but after that I was able to find a solution. Very fun kata, not like any I had done before, +1
Well now I feel silly.
I don't think the problem is well explained at all.
So, that's it! Thanks, now totally explained.
In all of the initial tests Hands are created, tested once and then freed. That let me to the assumption that it would always be that way. My mistake. Thanks again.
yes, but what is the issue here ? you modify
tracker
yourself, so you mutate the state of yourHand
object. then at the next call with the same object, of course the mutations will persist. take a look at how the random tests work, all of the hands are built beforehand and are played against each other at random, it is very likely that one hand get used multiple times, hence why the changes persistThanks, but that result would be expected - buildTracker() should indeed set values into the tracker field.
Let's use your test approach, but before any calls to buildTracker:
Output includes:
it seems to be your own code that modifies the
tracker
field though, I slightly modified your test incompare()
:the assertion fails.
cool))
This comment is hidden because it contains spoiler information about the solution
This code does not really confirm anything because we do not know how your real code, the one which breaks things, looks like.
Loading more items...