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.
In your solution, if you remove the 'Walrus operator',
nothing will change.
Everything worked,
and will continue to work without the 'Walrus operator'
'Walrus operator' capable make this solution more efficient oneliner. Open for arguments...
Is this mathematically correct ? I don't think it will work for all integers..
Neither best practice or clever. Same goes for the other solutions which are highly rated.
better use an enumerate's argument for the start index
630ms still seems like a long time. My solution is repeatedly under 75ms. I notice that your solution, like many others, creates an extra array. You are also summing the list, then substracting from that sum. Best to work through the list backwards, summing as you go with each iteration. And then just removing the list items that aren't leaders - this makes for less manipulation of the string.
Not only it's slow but this creates a new list instad of removing stuff from the original as stated in description
Thank Guido for Python :D
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Now imagine we cannot index lists beyond their actual sizes :)
nice
it's still
O(n²)
, even in this case:n*(n+1)//2 = n²//2 + ...
terms added overall (as you actually stated)O(n²)
The other solution is
O(n)
yes it is.
is your solution more efficient than that?
Loading more items...