Ad
  • Custom User Avatar

    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

  • Custom User Avatar

    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.