13
grutte_pier
11 24
743/ 845
Jakob van Bethlehem
Last seen 5 years ago
Member for 10 years, 4 months
Difficulty Normal
Best reviews / Newest reviews
First-Alpimarc
Normally you would _import_-statements at the top of the code, not inside a function More
First-Federigo
_re.findall_ already returns a list, even in Python 3, and the construction _list(set(ltext))_ looks very weird, as you're 'converting' a more restricted type into a less restricted type - that's an indication of some logical mistake in all programming languages. In this particular case, I guess you More
Smart, isn't it ?-Goulu
Which part do you consider 'smart'? You may refer to the last line, which requires some much explanation. It's a nice trick, but also overlooks the fact that you can much easier use something like: max(sorted(freq.keys()), key=freq.__getitem__) or, even better, max(string.ascii_lowercas More
Almost a oneliner O(N) using creative min()-Arandomusername
This is most definitely not an _O(N)_ solution, because the _count()_ needs to traverse the full _text_ for each _x_ inside _text_, in other words, this is clearly an _O(N^2)_ solution (like the major part of the solutions presented for this mission). More
First-flame_0n
Unfortunately CheckIO does not (yet) provide a means to benchmark solutions, but my guess is this would most definitely not be a 'speedy' solution, because for each character, you traverse the full _text_ - in the worst case scenario (only single appearances of each character, think for instance _te More
First-witpaard
* Why not looping over _text_ when calculating _amounts_? That way you only count letters that actually matter. * _alphabet_ is also known as _string.ascii_lowercase_ * instead of getting a _max_count_, and then trying to figure out which letter goes with that count, you really should look into usi More
First-diejmon
Certainly a nice and readable solution, but not 'speedy': it's _O(N^2)_, because you need to traverse _text_ fully for the count for each letter - there are _O(N)_ solutions already posted however, which make use of a histogram. These will clearly be much speedier More
First-HanleyWashington
Why not use the _key_ parameter to the _max()_ function? More
acre-hiroyuki.yamasaki.56
I think it is a rather clear solution, suited for beginner programmers. Anyone who likes this solution, should next study: * the _list_ type and the member function _count_ * the _string_ module (in particular _string.ascii_lowercase_) * the _max_ function, and the parameter _key_ one can pass to it More
The Most Wanted Letter-schanjr
I like that you made me look up the documentation of the _Counter_ class, which I didn't know yet - I also like that you used a histogram, which makes this a _O(N)_ solution, instead of the _O(N^2)_ solution using _count()_ that most people did. Beyond that I think there is room for some improvement More
First-rogerk2
holy smokes - I though I had a long solution.... This one could have used some (English) doc strings More
FOOL answer-nakanohito_piyo
Instead of permutating the indices into chips, you could easier permutate the chips directly on line 16: for ordering in itertools.permutations(chips[1:]): The same for the second set of permutations: simply permutate the objects you want to directly. More
Solve integer relation to find amount of fed pigeons-grutte_pier
If you like this solution, also have a look at the much better implementation of essentially the same (arithmetic) solution by [bunnychai](http://www.checkio.org/mission/feed-pigeons/publications/bunnychai/python-27/arithmetic/) More
Returning a new class-richshelswell 1
Interesting, didn't know you could assign methods like this. Is this capability limited to Python 2/3, or does it work in both versions? More
Just couldn't get rid of the double loop-grutte_pier
Looking at other solutions, I should probably have categorized this one as speedy.. More
First-JulianNicholls
I don't really like the fact of doing calculations on a static data structure. To me it means you picked the wrong data structure. More
Mark Pilgrim's library-macfreek
Maybe next time get rid of everything that is not relevant for the task at hand. More
First-AmaroVita
Nice, creative solution. Due to the many 'magic' numbers I wouldn't classify as clear though. But I expect this to be an extremely fast solution, so I'd categorize it is 'speedy' More
Lookup-veky 1
This has to be the fastest of'em all :). Did you use your other solution to generate this list? :P More
First-ciklop 1
In Python a True is always taken as 1 when used as a numeric value, so this nice solutions could be even shorter: return sum([x > y for x,y in combinations(s, 2)]) More
1 2 3
4
5