38
juestr
17 44 52 Leader of the month
8720/ 9195
Awesome Team Jürgen Strobel
Last seen 22 hours ago
Member for 5 years, 1 month, 11 days
Difficulty Normal
Best reviews / Newest reviews
Check the map!-evrur97
It's probably more pythonic to use a straight membership test for mapping than the empty string `''` guard value. if c not in mapping or mapping[c] == str2[i]: Maybe shuffle the conditions around too to avoid re-assignments of the same values and better distinguish the 2 interesting cases: More
Going for readability-evrur97
Very readable, except for the double negation. You could invert every condition, and use `and` to combine the results without nesting brackets: return long_enough and has_digit and has_uppercase and has_lowercase More
First-ssk8
Sometimes the most obvious solution works best, even if some people scoff at a lack of mathematical elegance. More
itertools.combinations-David_Jones 1
As far as I can see there is no reason to put an empty string on the initial stack? If using an empty list, the return value could become just `not stack`. More
First-Chocolater
You don't need to break dicts into 1-element dicts if you recurse into `tree.values()` directly just like for lists. On a side note it's probably more pythonic to use the builtin `isinstance` method for the type check. More
refactored recursive descent-juestr
Looking back at this I discovered I made a mistake and pruning visited parts is inefficient. More
First lambda-denisbalyko
There are much faster solutions that do not need to fully sort the input, much less sorting several times. Should be filed under creative. More
First-StIKEG
There are much faster solutions that do not need to fully sort the input. More
First-Alejen
There are much faster solutions that do not need to fully sort the input. More
First-Arandomusername
There are much faster solutions that do not need to fully sort the input. More
First-AlexSobral 1
There are much faster solutions that do not need to fully sort the input. More
from functools import idea-veky 1
Overkill, but educational value. You could replace `count` with a `get_children` function, this way you get by with simpler direct recursion (and without some non obvious edge cases) in tree_walker, and use only half the precious stack space. _I don't like the single line def formatting._ More
DFS-juestr
I found this is not very efficient (~20s on the biggest test) yet. Maybe I'll find some time to update it, I suspect tracking non-lamp positions explicitly would greatly improve it. More
First-Tinus_Trotyl
Nicely done, similar to mine in regard to the extracted format function and the use of bitwise ^. My use of the latter was more extreme though, flattening each char to a single 15 bit int. The while loop should probably be a for loop since it's deterministically enumerating character positions More
lambda func-brispol19
You could move the last clause to the front and just drop its negated form currently there. More
Simple DP-nickie
Nice. I thought about doing a top-down DP solution using `@cache`, but got lazy when the recursive generator felt fast enough. More
Recursive Generator-flpo 1
Is this truly correct? It appears to me that the code will not ever multiply by zero. More
15-liner: cleanest-przemyslaw.daniel
The generator `(x for x in queue)` is weird. On first glance it seems superfluous, but on second glance it is what keeps the for loop going, since its underlying `queue` is extended in the loop body. I am not sure this even defined behavior. A straight `while` taking the first element of queue woul More
First-dagger126
Strictly speaking the way you `split()` is incorrect. Words might be separated by punctuation only, although no tests do this. More
I found this tool in my Grandpa's attic.-veky 1
That's cool, but I guess it relies on unique node values. Which the examples and tests imply, and maybe graph theory also, but my developer self would have needed it spelled out. :/ More
1 2
3
4 5 6