34
DiZ
14 34 43
7059/ 7195
Last seen 2 years ago
Member for 11 years, 5 months, 27 days
Difficulty Normal
Best reviews / Newest reviews
O(n) :-P-veky 9 1
Well, your solution is O(n) but need unnecessary treatment, I think. At least, why do you make 2 Counters? May I suggest this following, very similar to yours but with less memory used: def checkio(data): from collections import Counter count = Counter(data) return [n for n i More
no module-Pouf 4 1
Changing the beginning of the year is a nice idea. Maybe extracting a function to compute days would be nicer: def days_diff(date1, date2): def days(date): y, m, d = date correction = m <= 2 y -= correction; m += 12*correction - 3 More
First-bpvital 3 1
To my mind, this solution is not really creative. Moreover, it presents several flaws: * Use python unpacking with * operator instead of enumerating indexes: _date(*date1)_ * As pedrobueno mentions, *timedelta.days* is useful here. * Why 2 _return_ statements? Last one is useless (as extra variabl More
Professional-veky 2 1
Python 3 annotations, very nice! Just to mention it to future readers ;-) : Switch lines 11 and 12 and you have a solution that runs 20x faster, rather than this one which runs in more than 1s on my slow (very slow) computer! More
receive, review, rewrite, reveal, relish-veky 2 1
I definitely like the representation you have made, keeping stack and moves in same list; even better with the use of `slice`. However, I can't tell I'm fond of this list/''.join step on tuples. If you wanted to introduce some performance with the use of `deque`, I have the feeling that looping two More
Second-old_user 2 2
Again a wrong solution on left-down diagonal: Tested with: checkio([[1, 5, 4, 4, 3], [2, 2, 4, 1, 5], [1, 4, 3, 5, 4], [4, 3, 3, 2, 5]]) Correction is in line 20: if (x+4 <= l_x and y+1 >= 4 and More
60-DiZ 2
And certainly possible to go down by changing type test. Edit: Well, Veky's idea breaks down character count: 'd*0==0' More
Second-atrioom 2 2
Simple approach (not as ugly as you said!) Just to give you a more pythonic implementation: def checkio(number): pig = newpigs = 1 fooddif, food = 0, number while food: oldfood, food = food, max(food - pig, 0) fooddif = max(fooddif, ol More
Only the first and the last week matters-suic 2 1
Easier: the most frequent day is always the first day of the year. Second day of the year has the same frequency than the first one when its year is leap. More
Exception mishandling-veky 1 1
Such exotic lib with use of recent RecursionError, I bet this solution is Veky's! Nice union-find algorithm, although handling cycles by exceeding max depth recursion limit seems a bit inefficient (and wrong on very big graph - 1000 edges, isn't it? - but I don't hope such big tests at CheckIO :-P) More
arithmetic-bunnychai 1
Nice solution (quite the same on my own, except I reasoned on k-1). Just a bit surprised by last line ; why not simply ;-) : return max(t, number - s) More
First-Vesagran 1 1
This is effectively a DFS. You can search for Dijkstra's algorithm if you want to learn more about. Just a few things: lines 8-14: you can factorize these lines for 'clearer' code pair = drones.split("-") for index, drone in enumerate(pair): if node == drone and pair[index - 1] no More
First-laserpez 1 1
This code searches through _text_ 26 times - it is not what I call a "Speedy" solution. More
First-yoichi 1 1
Smart way to "limit" your grid but here you should use 'infinite' grid by memoizing live cells, truly easier. More
Second-yoichi 1 1
Better than first one, really more readable! But still a niptick: imagine you have 2 live cells (0,0) and (100, 100). Are you really gonna loop through 10,000 (-2) dead cells for nothing? More
56 chars-Sim0000 1
Haha great! Still prefer lambda oneliners though :-P More
by definition-veky 1 1
I'm glad you chose to code such a mathematical masterpiece. I didn't have the courage to write it down ! More
One-liner with magic number-suic 1
for golfing, here is your solution in 65 characters ;) check_pangram=lambda t:len(set(filter(str.islower,t.lower())))>25 More
First-noobien 1
Strings are also iterable, so you can use _for_ loop and _in_ operator on them directly. More
Could be shorter-veky 1 1
'd*0==0'... Amazing, really. By the way, 1 more character to delete: space between 0 and 'and' ;) More
1
2 3