17
kumaus
4 13 28
1564/ 1695
Last seen 1 year ago
Member for 8 years, 8 months, 11 days
Difficulty Normal
Best reviews / Newest reviews
Beginner-chaitanyamaheshwari 1 1
The comparison checks are not necessary ... More
First-kuzdras 1
One of those cases where it is much nicer to use nested for loops rather than tricky list comprehenssions. More
First-farukardic
g(n) also has an explicit formula: g(n) = n * (n+1) * (n+2) / 6 More
First-lancelote 1
Rather than ascii_lowercase[ascii_lowercase.index(col) - 1] you might prefer to use chr(ord(col) - 1) This is (in my opinion) slightly cleaner regarding the possibility of negative index More
First-e.volgon 1
Two points: - To build your dictionary, it is inefficient to iterate through lower_text, as every letter will be counted multiple times. This is n^2, bad news for (very) long texts. Better use string.ascii_lowercase - You can also find the key for the (first) max value of a dictionary by result More
First-aminami1127 1
Just a nit: symbol_one*digit is a lot shorter and works as well as ''.join([symbol_one for _ in range(digit)]) More
First - Classical Union-Find-shellaylee
Does this work in every case? Suppose the network is [a-b, c-d, a-c] Then your for loop iterations of the root directory are 1: a-b root = {a:a, b:a, c:c, d:d} size = {a:2, b:1, c:1, d:1} 2: c-d root = {a:a, b:a, c:c, d:c} size = {a:2, b:1, c:2, d:1} 3: More
First-MichalMarsalek 1
To compute the set of rings, rings = set.union(*cons) would be simpler. Also, all the breaks and continues in the main loop look a bit cumbersome. You could get around this by refactoring, i.e. defining a function which checks a set of broken_rings, called from the second for loop. You More
First-cimarronm 1
for some reason, lower case characters have not been included in the problem statement. So, line 3 should also check c.isupper() More
Mine is ok-rapphil
Two small points: * The line largest = max(...) can be drawn outside the if / else block * ant_c = does not need to be repeated for every c. Could place it inside the else branch More
First-toito
The use of map in line 5 does not make the code shorter, faster or more readable, so I would prefer to use the straightforward return [sorted(young_or_old), sorted(middle_age)] Matter of taste though ... More
First-7577965
Shorter in line 28: steps.append(max(abs(z), abs(y)) More
First for The Most Frequent Weekdays-koyana222
Instead of checking for leap years yourself, you could ask datetime for help: Number of days is (datetime.datetime(year + 1, 1, 1) - datetime.datetime(year, 1, 1)).days More
First-tanya
Good golf, but a bit cryptic ... More
Fizz Buzz-McMayers
- d3, d5 and text are not used. - rather than testing x = int(number), you could put the whole if block into a try. - tiny nit: testing for x%15 == 0 rather than x%3==0 and x%5==0 is a bit shorter More
First-liangjieheng
The inequality checks can be left out, because they have already been covered by the first (divisible by 15) check. More
First-artakase
Nice! Not the shortest, but can easily be generalized to other situations More