38
juestr
17 44 52 Leader of the month
8788/ 9195
Awesome Team Jürgen Strobel
Last seen 7 hours ago
Member for 5 years, 1 month, 25 days
Difficulty Normal
Best reviews / Newest reviews
Math-Olpag 1
Nice. For degenerated triangles it should also return 0,0,0, so I think it should be a+b < c etc. in the guarding if. More
First chr + ord-LeonidPK 1 1
Separation of coordinate conversion and checking logic in int coordinates would make this both easier to read and possibly faster. More
First-IPK 1 1
This is not speedy, it's doing 2 nested loops over weights, for a O(n^2) solution. This can be done in O(n). More
sympy.topological_sort-Phil15 1
Cool. There's `graphlib.TopologicalSorter` in the stdlib now too, but it needs some tweaking to get the [alphabetical order correct](https://py.checkio.org/mission/determine-the-order/publications/juestr/python-3/graphlibtopologicalsorter/). More
First-reebbeer 1 1
A lot of code duplication. key() is called multiple times per element. Does it handle custom types? More
First-alexandrov.net 1
Ha I missed how the strings can be compared safely, else I did the same with key=. More
Use Numpy matrixes-U.V 1
Using a bit more from numpy you could vectorize everything in this mission. E.g. `numpy.subtract.outer` on points basically replaces your 2 outermost loops, it creates a matrix using a full outer join with pairwise subtraction for all points. More
Follow multiple states-HeNeArKr 1 1
Regarding rank, summing the indices appears to be flawed to me (despite weak tests). What you'd really want is the minimum num with the minimum of the first index as tie breaker, not the minimum sum of indices. Unless you can prove these 2 definitions are equivalent? More
Cramer EGCD-ogoro 1
Cool math, I guess, although I can't follow how the determinants matter. More
A139250-Phil15 1
Python's rather new built-in `int.bit_length` makes `msb` superfluous. Curiously everyone copied it or imported `math.log2` instead. More
First-xxxxxxxx 1 1
Using // (floor division) instead of / you wouldn't need to do conversion back to int. More
The Hiden Word-colinmcnicholl 1 1
A few suggestions: - ```for row, line in enumerate(lines)```, manual counting isn't very pythonic - shortcut returns directly in the for loops would be good here, no need for the 4 result vars at all, and wasted effort to continue after finding a match - transposing with zip_longest is neat, but you More
All combination of points, then group them-tokyoamado 1 1
Fraction is a nice touch, I was worried about using float but it did work for the current tests... More
st_re_ssful-Tical_1000 1 1
```if COND return True else return False``` can be trivially shortenend to ```return COND```, or ```return bool(COND)``` if COND is not of type bool already. More
First-yield...-Sillte 1 1
Index-based iteration is non-pythonic. This is much easier using language features properly, like str.split() or regular expressions and iteration with for. More
Batteries!-veky 1 1
I thought about this too and it works atm, but maketrans is not defined for the case of an inconsistent mapping. Future or other python implementations may raise an Exception without warning, and I'd rather call it creative for that reason. https://docs.python.org/3/library/stdtypes.html?highlight= More
In 2 string-RavenRu
Using ```min``` instead of ```sorted``` would be much more efficient with almost the same code. More
First-yoichi
Nice, I also tried an approach with permutations(). However checking adjacent pieces corresponding heights at the top of can_restore was not intended, and breaks some of the random tests. You likely got lucky, an example which is supposed to work but doesn't with your code is: [[0, 5, 1, 1, 0 More
First-vlad.bezden
I don't see how the key lambda can work? In the first example both 6 and 2 get the same frequency hence the output should be in order of input: [4, 4, 4, 4, 6, 2, 2, 6]. That was my first attempt too but it got rejected. More
4-liner: no title-przemyslaw.daniel 1
Tricky and very inefficient for large numbers, should be in weird category. More
1
2
3 4 5 6