6
votes
LeetCode 3542: Minimum Operations to Convert All Elements to Zero
missing docstring
def split_non_zeros(self, nums):
This is terrible.
The identifier is not bad, as far as it goes.
But we need to know what the function ...
6
votes
Accepted
LeetCode 3542: Minimum Operations to Convert All Elements to Zero
Style
First off, let's address a couple of style issues.
Looping over indices of a list is better achieved with enumerate than with ...
3
votes
LeetCode 3542: Minimum Operations to Convert All Elements to Zero
Simpler
Here are some general coding style suggestions.
The following:
counter = counter + 1
can be simplified using the special assignment operator:
...
3
votes
Hackerearth: Counting numbers in an array that are divisible by any 2 numbers
Always assume that coding challenge websites will give you worst case scenarios to test your code. They won't test your code with small arrays of small numbers. They'll give you large arrays with huge ...
1
vote
Hackerearth: Counting numbers in an array that are divisible by any 2 numbers
Portability
I realize this question was posted many years ago when Python version 2.x
was prevalent, but now that it is deprecated, consider porting to 3.x.
To do so, it is necessary to add ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
programming-challenge × 3402python × 1047
algorithm × 666
performance × 655
java × 636
time-limit-exceeded × 518
c++ × 492
python-3.x × 448
beginner × 429
c# × 298
javascript × 289
strings × 217
primes × 184
c × 161
functional-programming × 109
array × 105
haskell × 101
python-2.x × 94
interview-questions × 93
dynamic-programming × 87
ruby × 78
recursion × 77
palindrome × 76
object-oriented × 74
combinatorics × 71