38
Awesome Team
Stefan Pochmann
http://www.stefan-pochmann.info/
Last seen 14 hours ago
Member for 9 years, 1 month, 4 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?
Hmm, the top of this page still says "Creative solution for Collatz Ztalloc", but apparently there are no Creative solutions anymore (see screenshot). What's going on?
More
`collatz_convert(1)` returns `''`, but `collatz_convert('')` returns not `1` but returns `None`.
More
Your `any([k=='u' and len(list(g)) >= 2 for k, g in groupby(data)])` is equivalent to just `'uu' in data`, isn't it?
More
Why the special handling for `n < 9` instead of handling those cases like all others?
More
I think you could avoid the `+ 10**M` like I just did [here](https://py.checkio.org/mission/champernowne-word/publications/przemyslaw.daniel/python-3/24-liner-fastest-up-to-at-least-1010/share/bed7600900c0ee2539ac620cbc3e02eb/#comment-126535) in @przemyslaw.daniel's. (But maybe not worth it...)
More
For "Diagonal reversed", you could've reversed upside down: `diagonal(matrix[::-1])))` instead of `diagonal(m[::-1] for m in matrix)))`.
More
Think of 42 = 13+14+15 as 42 = (1+2+3) + 3\*12.
Think of 42 = 9+10+11+12 as 42 = (1+2+3+4) + 4\*8.
So go through the sums 1+...+n and test whether num - (1+...+n) is divisible by n.
Instead of a sum variable, I just subtract from num directly.
More
Previous solutions mainly fall into three camps, each with its own downside. This solution avoids all those downsides.
- The [LBYL](https://docs.python.org/3/glossary.html#term-LBYL) solutions check `border in items` before calling `items.index(border)`. That double search becomes slow for long inpu
More
Like my [original](https://py.checkio.org/mission/remove-all-after/publications/StefanPochmann/python-3/elephant-in-cairo-fast-all-rounder-with-benchmarks/share/2f2991cd6fa3280f7cf2bf62f0f6146b/) but simpler and might be faster. Here I temporarily *append* the border value instead of writing it into
More
Another benchmark where I try to expose the reallocations by both ins the same list object over and over again but instead make copies and use each only once. Despite all my efforts the results aren't super reliable, though, I might have to try again when I have access to a more stable machine.
```
More
Wtf... And you call **me** a "pairwise∘groupby freak"??? Let's see whether I can decipher this...
More
[Previously](https://py.checkio.org/mission/cipher-dict-decryption/publications/StefanPochmann/python-3/directions-please/share/6d032a971ac33cf1f3f252187039f79f/) I sorted. I believe it failed the tests without. If works now. Not sure what happened. I just saw Phil15's solution, which didn't sort, s
More
All just variations of the first solution, i.e., compare the first and last value of the current group and the new item.
I was lazy typing, so `a` means first group value and `y`/`z` means last two group values (if `z` were included in the group).
More
Memory of what? Of times when people didn't complain about PEP 8 violations and plagiarism?
More
Two ways, can't decide which one I like better.
Half of my old [LeetCode](https://leetcode.com/problems/isomorphic-strings/discuss/57892/1-liner-in-Python) solution for Isomorphic Strings.
More
I can't reproduce your findings supporting that this is "The Fastest". Please share your benchmark results and your benchmark code. Here are mine:
```
226 ns max
82 ns max_of_three
221 ns max
81 ns max_of_three
220 ns max
82 ns max_of_three
```
```python
from time import perf_counte
More
Benchmark results (executed on CheckiO):
```
226 ns max
82 ns max_of_three
221 ns max
81 ns max_of_three
220 ns max
82 ns max_of_three
```
Benchmark code:
```python
from time import perf_counter as time
from itertools import repeat
def max_of_three(a, b, c):
return (a if a > c
More
Same as my first solution, but after seeing @veky's title saying complex.
More
What's the explanation for counting odd divisors? Without that, this isn't "clear" at all.
More