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.
I am not sure where Codewars rules say thay you need to be as fast as possible :)
i mean, codewars is sbout doing it as fast as possible, even if its extremely ugly
Yet you're doing the same thing.
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.
nedemek istediğini daha basit açıklar mısın kral ?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
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)
This comment is hidden because it contains spoiler information about the solution
yes it is.
is your solution more efficient than that?
> Testing execution speed with super small inputs
> Telling people there's no benefit in using good approach instead of a bad approach
:thinking:
As I remember, Python creates .pyc files after first import and then will use cache without real import, so it doesnt influence perfomance a lot, but sorting the same string at every iteration does.
This comment is hidden because it contains spoiler information about the solution