27
kudinov.feodor
6 26 43
4076/ 4195
Федор Кудинов
Last seen 10 hours ago
Member for 4 years, 10 months, 5 days
Difficulty Normal
Best reviews / Newest reviews
First-ssk8
return ing list in line 5 makes no sense since return of generator is not used, you can replace line 5 by: return More
Just works-amandel 1
I believe idea of a task is to take items from iterator 1 by 1 and yield them as you go. but in line 2 you process all items at once. Imagine if you receive as input never ending iterable object. More
bfs-kazuki.h
13 - 16, 24 -27, hardcode is usually not good idea, I prefer small loops for repeating parts of code More
a0, b0 = intervals.pop(0)-flpo
intervals.pop(0) makes you stick to specific data type i.e. list better to take iterator from intervals and use next to get 1 item iterator = iter(intervals) a0, b0 = next(iterator) of course StopIteration error can happen if iterator is empty More
First-tokiojapan55
12 line - list good target to be segregated to CONSTANTS More
Getting eval function-Steapn0806
cheeting )) though most understandable sulution More
First-brispol19
first hour I tried to do something similar, but did not manage More
Univocalic davasaan-JimmyCarlos
lines 1 - 4 look like binary shift, what is the difference? More
First-bloodyrabbit
now I understand why this task ment to be Elementary ) More
First-ot0 1
to be speedy, you need at least use generator expression your solution is not memory effective def sum_upto_n(N: int) -> int: return sum(i for i in range(1, N+1)) More
First-Max0526
if you have more than 1k stones you will have troubles More
First-flowerinapot
also if you add 0 stone to stones, you can remove if else block, and leave only 1 return More
First-flowerinapot
better to avoid sorting on every loop, sort once, and insert into expected position to leave stones sorted More
Simple solution-dan_rue
I would argue that such way will also do the job ((x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)) but still I saw some practical example of ~ usage, rather tricky one like usage of bitwise shift to multiply 2, but still More
Naive solution-Nollikino
ideally you should not use magic methods you can take same functions from 'operators' module from operator import add, sub, mul, truediv More
return f-strings, except age..-Olpag
If you need to work with dates, better to spend time learning how to use python date, datetime More
Boring solution-CDG.Axel
I spent much time on that task, but for someone it is boring )) More
for if-Mc.Sim
you can reduce text.split() calls and work with list and not string More
No recursion/regex/lambda/import/comprehension, just standard library-darkfire518
oh wow so over enjeneered while loop could easily handle this ) More
One-liner-darkfire518
if to move len(items). to sepparate variable it will simplify code and suggest ways for further simplification i think 2nd list could be handled by negative indexing, smth like: items[-len(items)//2:] but need to check of course More
1 2 3
4
5 6