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.
For anyone looking to copy this digit count snippit, be aware that the digit count line will fail to count the number of digits for zero (1). It returns -Infinity. It doesn't matter for this problem because 5 to the power of -Infinity will return 0 and not NaN. (multiplying -Infinty by 0 produces NaN, apparently).
You have a very weird opinion regarding someone's ego. I guess exactly you show off here
This solution r*cks.
for real?
I presumed the O(n*log(n)) solution wouldn't even be allowed.
Yours is a cleaned up version of mine
This fails when
code
(num
) is0
: it raises a ValueError.noice
This comment is hidden because it contains spoiler information about the solution
The
i
here is just a number, soi+1
is fine. If you had tried to dolines[i+1]
then you might run into an issue.But also
range(0)
is empty, so no values are computed for empty lists anyway.Hi,
I wrote this code as a starting point but did not expect it to pass all tests.
I do not understand why it works with empty lists.
If lines is an empty list, then len(lines)=0.
So {i+1} should generate an error, shouldn't it ?
thanks :)
FArekkusu's brain be like;
O(n) speed < O(n log n) : n <= 1
XD
Your first comment to the solution is literally saying, "My Solution is Better than the top solutions"
Unless you dealing with huge data sets that upscale tremendously, using binary search is not more than making a one line code translated into nonsense, which is exactly what you did, I hardly believe and employer will ask you to do this for something that has a time complexity of O(nlog(n))
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...