38
StefanPochmann
16 39 54 Leader of the month
9144/ 9195
Last seen 3 hours ago
Member for 9 years, 1 month, 22 days
Difficulty Normal
Recent solutions I'm happy with (just starting/trying this): [Words Order](https://py.checkio.org/mission/words-order/publications/StefanPochmann/python-3/short-dict-subsequence/share/5bbb2df54ec5a810d36d7f70ae7e92da/) Dang it no markdown here?

Best reviews / Newest reviews
Something from Nothing-StefanPochmann 1 1
Alternative title: "FOO, BAR, ..." More
Counter-wise counted-Tinus_Trotyl 1 1
You [reinventor](https://github.com/python/cpython/blob/de7a2f04d6b9427d568fcb43b6f512f9b4c4bd84/Objects/listobject.c#L2306-L2314) :-) More
2 line different from Ulam original-dig 1 1
If you're willing to handle float imprecision like that, you might as well use complex numbers. Then you could generate the neighbors of a point `z` simply as `{z + 1j**(i*2/3) for i in range(6)}`, and `almost_equal` of two points could simply be `abs(z1-z2) < 1e-5`. I used complex numbers for the n More
5 liner! using "eval" and "try".-tamagoyaki 1 1
That's pretty bad. Try `postfix_evaluate([2, 3, "/", 10, "*"])`. Causes an infinite loop and memory explosion, because you mistake the float for an operator. If you use `type(v) == str`, that problem goes away, but you incorrectly return 7 instead of 0, both because you round instead of flooring and More
Maybeline-veky 1 1
Hmm... how did you get that here? The function name is wrong, the return type is wrong, and I just tried it and it does get rejected. Edit: Ah, [I see](https://py.checkio.org/forum/post/12041/new-mission-the-highest-building/) that was apparently the original format. Does CheckiO not rejudge soluti More
1-liner: 59 chars-przemyslaw.daniel 1
Save two chars: ``` [x]+[0]*(x==0) [x,x][x!=0:] ``` More
Simple-StefanPochmann 1
Explanation: For each center cell c, go through all cells and count the bacteria at each Manhattan distance. Then use that to find the smallest non-full "ring" around it and if that ring is empty, we found the radius of the colony. It's not efficient, but it is simple (and it doesn't have to be eff More
max len of dict-veky 1 1
Just a variation... long_repeat=lambda l:max(map(len,__import__('re').split(r'((.)\2*)',l))) More
juestr's compressed-veky 1 1
8 chars less: ```python changing_direction=lambda e,p=lambda s:[aMore
sympy can handle permutations-Phil15 1
Somewhat golfed: ```python from sympy.combinatorics.permutations import Permutation fifteen_puzzle=lambda g:Permutation(L:=sum(g,[0])).parity()==sum(divmod(L.index(16)-1,4))%2 ``` More
Cycle (de)composition-veky 1 1
Combining your backwards idea with my "speedy" idea of using one lookup per move: ```python from functools import reduce u, f, r, l, b, d = ({'side': i} for i in range(1, 7)) def set(state, *NSWE): state |= zip('NSWE', NSWE) set(u, f, b, r, l) set(f, d, u, f, f) set(r, r, r, d, u) set(l, l, l, More
Pochmannia!-veky 1 1
Hmm, now what to do with this... I gave the original +5 for its neat insight/algorithm. I do like this version better, but it didn't give me that same Aha! moment again... More
64-StefanPochmann 1
Note that `*` binds stronger than `in`, so the `*` is not your typical simple `and` replacement between two bools here. This is even "fast"! As soon as one letter is missing, the others are only searched in the empty string. Too bad I still `upper` the string before imploding it. More
First-tokiojapan55 1
Could've been clearer without the shift. Put "zero" at index zero, "positive" at index +1, and "negative" at index -1. ```python def determine_sign(num: int) -> str: sign = lambda i: (i > 0) - (i < 0) return ["zero", "positive", "negative"][sign(num)] ``` More
Simple BFS-ale1ster 1 1
Hmm... you never put anything in "visited". More
vek-StefanPochmann 1
Unfortunately I looked at veky's solution before thinking much, so I can't claim this as my own. I made the regex shorter, though. More
if total else data-veky 1 1
I'd say removing less than nothing shouldn't remove *everything*, like this does for `remove_min_max({1, 2, 3}, -1)`. More
uno reverse card-viktor.chyrkin 1 1
Inspired by yours: def remove_min_max(data: set, total: int) -> set: for extremum in [min, max] * total: data.discard(extremum(data, default=None)) return data More
Simple simulation-StefanPochmann 1
If I remember correctly, I got that complex number trick from @veky years ago. More
Count cube coordinates-Phil15 1
As a speedcuber, I'm loving this. It's like [these six edges](http://www.randelshofer.ch/rubik/patterns/U040.02.html). More
1
2
3 4 5 6 7 8 9 10