17
abe.dillon
3 16 32
1622/ 1695
Abe Dillon
Last seen 5 years ago
Member for 9 years, 3 months, 18 days
Difficulty Normal
Best reviews / Newest reviews
eiji-eiji 9 2
O(n^2) complexity is very sub-optimal for this problem. Checkio should have added tests with very long lists to highlight the performance problems with this solution. assert checkio(list(range(100000))+[0])) == [0, 0], "big list" Takes over 2 minutes on my computer using your solution. While an O( More
First-Amachua 4
You know the pythonic way would be to use a dictionary look-up right? ;-P More
~Shortest-veky 3 1
I want to say that while this is concise and the use of lambda is creative, this solution has a pretty awful time complexity of O(n^2). Normally, I prioritize clarity over optimization, but it pains me to see the [x for x in d if d.count(x)>1] solution tagged as speedy so often. This being an educat More
Low Level-PositronicLlama 2
I'm giving this a thumbs down for miscategorization. While it is true that this is quite easy to read, it would much more fitting to tag it as "speedy". (just kidding! thumbs up!) More
First-gyahun_dash 1 1
I think this should be tagged as "creative" rather than "clear". It's a very cool solution, but if you write code like this in a workplace (particularly the `corners` method) people will hate you. More
Broken code-veky 1 1
I'm just going to thumbs you up and walk away slowly... More
First-Sim0000 1 1
Your wish has been granted! https://docs.python.org/3/library/enum.html More
The Most Wanted Letter - smasse294-smasse294
Computers are very good a simple repetitive tasks, so when you find yourself repeating simple code so much, it's a good sign you can simplify things. Languages like Python offer tons of tools for capturing repetition: data-structures, loops, functions, classes, etc. In this case you're using variabl More
Rasterized-PositronicLlama
Your comments are incredibly helpful! Thank you! More
lambda-xiongbiao
this has a time complexity of O(n^2) because data.count(x) visits each item in the list (O(n)) and is evaluated n times. More
First-drmarkgreen
the time complexity of this solution is O(n^2) because data.count(x) visits each item in the list (complexity O(n)) and you call data.count(x) n times. The fastest possible solution to this problem would have a time complexity of O(n), which means if you got a list of 1,000,000 items your solution w More
1 Counter-DiZ 1
This is a good solution that actually achieves O(n) complexity instead of the O(n^2) complexity of many of the "speedy" solutions for this problem. I am curious why you used 'c = __import__("collections").Counter(data)' instead of 'from collections import Counter'. More
Θ(n)-jcg
Good solution! The collections module has a 'Counter' class that does the same thing as the first three lines of your code. More
flood fill-gyahun_dash
Nice use of standard library tools! More
58-DiZ 1
this is pretty awesome! the use of `or` to perform your sort before calculating the mean is neat and the +/- indexing trick is fun, but the bitwise inversion of -len(d) was incredibly tricky! I hope you don't write production code this sneaky! More
First Encounter-Istorian
This is a good solution. You should check out the Hitchhiker's Guide to Python. Looping over indexes isn't very Pythonic. Something like the following would be much cleaner: if len(data) < 10: return flags = [False]*3 for c in data: flags[0] |= c.islower() More