Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
Although this is a perfect refactor of the code, I don't see it as being the best practice for this excersise, since the job was explicitly to debug the existing code (for practicing loops) and not entirely refactor it to something else.
yes starting value of range() is 0 so defining it as 0 makes no difference.
Could be improved by caching the previous result and just multiplying it by 2 instead of calculating the whole 2^n.
this one is should be the top solution
this is probably the fastest solution, possibly because it does not use the
**
(square) operator. I compared these top two solutions usingtimeit
used
timeit
to compare the performance of your solution with the top two above, and it outperformed themhave heard coders criticize the general use of generic
for
loops, buttimeit
has convinced me that my solution is performant—after comparing it with three other solutions.This comment is hidden because it contains spoiler information about the solution
how does this work?
have you used
timeit
to compare the performance of yourCounter()
solution with this one? I personally believe that your solution could be 10X slower.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
[[]]
<-- nothingburgerthanks for bringing this up. actually a 0 dimensional matrix because it fails to contain any values. it is an empty shell; a random tests byproduct for frustration purposes. would help to see this specific empty matrix in standard tests.
Loading more items...