45
Valentin Bryukhanov
http://bryukh.com/
Last seen 2 years ago
Member for 11 years, 7 months, 17 days
Difficulty Normal
Developer, engineer and taskMaker.
It's Depth-first search, right?
Interesting using of "for...else.." construction.
But it's bad practice to change input list.
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
> THE ANSWERS TO EVERY QUESTION IN THE KNOWN UNIVERSE IS NOT 42 BUT YOGURT
THEY hide the Truth and 42 is a false track :-)
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
Be careful with recursive for bigger data. You can look at dynamic programming method for this task.
More
key = lambda x: x[1] * 1000 - ord(x[0])
Hm, it looks weird imho. What is it?
More
It's almost "clear" solution. Short and simple, but please don't use long lines -- it's hard for reading. :-) The new PEP8 allows 100 characters per line.
More