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
thanks man, this just opened my mind to a few other solutions :D
This is my first problem and I am already surprised by the clever solutions out there :)
This comment is hidden because it contains spoiler information about the solution
how come there's no need for a comparison between the modulus statement and its answer for it to work?
i used chat gpt to understand how it's works :]
looks very cool
Still not fixed.
I just used long doubles and regular round() function. Solution is literally a 1-line one.
My bad...
std::sort
performs comparision based sort, which cannot have worst case algorithmic time complexity lower thanO(n*log(n))
Well, it's O(2N) to be precise (an std::sort and a for loop). And yes, there is.
Is there even an O(n) solution to this problem? :)
I know this is a performance kata, but the fact that an O(N) solution (2nd best time complexity) doesn't pass is just ridiculous.
Loading more items...