21
Andrius Mk
Last seen 9 years ago
Member for 11 years, 6 months, 13 days
Difficulty Normal
The curiosity is the main driving force.
Crazy as f... and complicated as sh..
Haha, i did this in a really similar way :)
Although I wanted to add really scary implications into the code, so I implemented it through a generator :)
I wonder how many will figure out those scary implications :}
More
math.sqrt, filter... yayk
a plus for itertools.product :) Didn't know about it (I'm guilty of never being a fan of built in modules)
More
for c in sorted(chars):
wouldn't it work the same if:
line 2: chars = sorted(set(''.join(data))
line 6: for c in chars:
line 14: chars.remove(dec[-1])
More
Interesting solution. As I understand this one will return any path it
encounters first, not necessarily the shortest one.
Anyway, the code is clean and understandable. Interesting way for
representing moves.
More
One of the shortest(optimal code-wise) solutions:)
Although lambda is misused here...
More
I am aware this is not optimal. Sometimes it's unsafe. Gonna learn A* for this task:)
More
If the solution to this problem would be generated using GA, then one of them would look like this :)
Love it :)
More
Great job! Overly complicated, albeit rather impressive! +4
More
You might be interested in checking out a version of this algorithm that uses list comprehensions and generators :)
More
if isinstance(n, int) and n > 0 and n < 1000:
Python 2.7 has a built-in xrange which is a generator which in turn unlike built-in range doesn't hold in memory the whole list of numbers. Python 3.* has only built-in range which behaves like xrange in Python 2.7.
More elaborate discussion e
More