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.
This comment is hidden because it contains spoiler information about the solution
This solution passes the tests but to me is definitely not best practice. This solution works in python 2, and not in python 3. But if you just sort r it works the same in py3 as in py2. That's the difference. r comes out mostly sorted in py 2 from the creation of the set apparently.
BUT it still is not a great solution in py2 (or py3 with the sort). Yes it passes the tests, but it's not always going to get the right answer to different valid inputs.
For example - if you feed in the last test reversed (recreate alphabet backwards) it fails. But if the loop is run twice instead of once it does pass. So additional looping may be needed accurately reconstruct the secret with this approach. To see it fail trying to create alphabet backwards fork and add this to tests:
secret6 = secret5[::-1]
triplets6 = [x[::-1] for x in triplets5]
test.assert_equals(recoverSecret(triplets6), secret6)
This solution works for the given tests, but if you insert random numbers (E.g. - 11, 99) it does not detect any problem.
Well clearly I've come up with a superior algo. This bad boi will calculate correctly formed and incorrectly formed roman numerals - E.g. IIIV = 7. I mean who actually knows how to properly form this ancient crap? This one can do it all!
This was fully intentional and totally not because I'm a failure at ancient accounting. /s
I'm pretty confident there's a problem with the fourth test. The board matrix seems valid but the test expects a False return. I'm using Python.
The problem board is literally identical to the previous board that passes the test, except for the last two numbers in the last row are reversed. As they are the same numbers in the same 9X9 sub-board this is no reason for the test to fail. The sub-board does contains 1-9. (Sorry for all the empty lines below, editor was trying to display it all on one line. not sure how to force newline)
Log Test 3
[[1, 3, 2, 5, 7, 9, 4, 6, 8],
[4, 9, 8, 2, 6, 1, 3, 7, 5],
[7, 5, 6, 3, 8, 4, 2, 1, 9],
[6, 4, 3, 1, 5, 8, 7, 9, 2],
[5, 2, 1, 7, 9, 3, 8, 4, 6],
[9, 8, 7, 4, 2, 6, 5, 3, 1],
[2, 1, 4, 9, 3, 5, 6, 8, 7],
[3, 6, 5, 8, 1, 7, 9, 2, 4],
[8, 7, 9, 6, 4, 2, 1, 5, 3]]
Test Passed
Log Test 4
[[1, 3, 2, 5, 7, 9, 4, 6, 8],
[4, 9, 8, 2, 6, 1, 3, 7, 5],
[7, 5, 6, 3, 8, 4, 2, 1, 9],
[6, 4, 3, 1, 5, 8, 7, 9, 2],
[5, 2, 1, 7, 9, 3, 8, 4, 6],
[9, 8, 7, 4, 2, 6, 5, 3, 1],
[2, 1, 4, 9, 3, 5, 6, 8, 7],
[3, 6, 5, 8, 1, 7, 9, 2, 4],
[8, 7, 9, 6, 4, 2, 1, 3, 5]]
True should equal False
contents of individual sub-boards for both boards:
[1, 2, 3, 4, 5, 6, 7, 8, 9]