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.
The front part's short and sweet.
However, the last line is wrong. Just because the board contains at least one unfilled square doesn't mean it's not solved yet.
For instance,
1 1 2
2 2 1
1 2 0
is a draw, but this code returns -1
This solution is incomplete though elegant, it will fail for some test cases currently not included.
The 'for l in triplets' loop shouldn't run just once, it should run until there are no more swaps.