34
Last seen 2 years ago
Member for 11 years, 6 months, 11 days
Difficulty Normal
I tested this solution, 100% success on 10000 random tests (right hand rule is very useful)!
But it does NOT pass your maze test.
More
for golfing, here is your solution in 65 characters ;)
check_pangram=lambda t:len(set(filter(str.islower,t.lower())))>25
More
Nice solution (quite the same on my own, except I reasoned on k-1).
Just a bit surprised by last line ; why not simply ;-) :
return max(t, number - s)
More
Strings are also iterable, so you can use _for_ loop and _in_ operator on them directly.
More
Smart way to "limit" your grid but here you should use 'infinite' grid by memoizing live cells, truly easier.
More
I'm surprised, finally we have different solutions but (nearly :-P) same code length!
More
Better than first one, really more readable!
But still a niptick: imagine you have 2 live cells (0,0) and (100, 100).
Are you really gonna loop through 10,000 (-2) dead cells for nothing?
More
That's a nice solution! Just one niptick, no need to cast output to `list` ;-)
More
You should look at _for_ loop.
Or if you really want to stick with _while_ loop:
if list[i] > list[j]:
output += 1
j += 1
else:
j += 1
Here it is better to write, simpler and more readable:
if list[i] > list[j]:
output += 1
j += 1
Or even bette
More
Maybe simply using Python chained assignments
__eq__ = __ne__ = __gt__ = __lt__ = __ge__ = __le__ = lambda a, b: True
More
Note that you can make several operations on the same line and you can also factorize common code (both in _if_ and _else_ statements for better readibility.
More
Can you explain a bit deduction part from (1) and (2)? I'm really interested in.
More
Better than recalculate heuristic, you can simply use _cost_ and add right speed:
new_cost = cost + 2 / speed + (field_map[j][i] == 'B')
More
[Mine](http://www.checkio.org/mission/flatten-list/publications/DiZ/python-27/50/) is shorter, mine is shorter! :-P
More