45
Valentin Bryukhanov
http://bryukh.com/
Last seen 2 years ago
Member for 11 years, 7 months, 16 days
Difficulty Normal
Developer, engineer and taskMaker.
Nice! Interesting replace of combinations. But you can speed up your solution, because 101 == 010 for this task.
More
Very impressive one-liner and it's fast. Can I take your solution as a reference for the tests?
More
It's very interesting variant of combinations. I didn't know about this. Thank. And i upgraded my solution after your comment (bryukh_old my old login).
More
+ for percolate algorithm. But lines 20-39 can be shorten in function. Don't repeat yourself (DRY).
More
copyOfData = data
For lists it's not a copy, you just created one more link for the same array. If you will change one, then you will change other.
You can count elements with the method "count"
[1, 2, 3, 1, 1].count(1) # return 3
More
It's not DRY (Don't Repeat Yorself). You can merge four block for moving in one loop or function. And "return" without anything is not good -- it's little confuse.
Good comments.
More
Hard to read long lines.
For unsolvable puzzle, you can check solvability (count inversions).
More
it's not fast -- i know, i can cached some variants for speed. But sometime i am lazy :)
More
Great solution. Simple for understanding. I agree with Kvas about Fraction -- slow thing. But this solution easy modified to float. So it's not important. Thank you for interesting solution.
More
:) Thanks for this solution. It's funny, really. Crazy blind adventurer :)
More
You solution does not work for x0 > 10, because "{:+.3g}".format(12.12) == "+12.1"
More