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.
Considering you capitalised like half those words, probably the latter
I totally agree with the "longest streak" part.
I mean, why single this one out? Just keep the same format as before:
Each streak is worth
As for the sorting, sort() and sorted() are both STABLE in Python, meaning that if you don't provide any other keys, it would automatically keep the original order in case of a tie.
That's why both yield the same result.
yassss baby lets gooooooo!!!!!!!!!!!
This comment is hidden because it contains spoiler information about the solution
OP solved it, closing!
.
WTF? The solution I see just returns the 5 hardcoded sample tests. What did you expect?
If you have any actual code, you can post it here with spoiler flag, or somewhere on Discord CW server. But given that it is a puzzle kata, you're not likely to receive much help.
Read this: https://docs.codewars.com/training/troubleshooting#post-discourse
This comment is hidden because it contains spoiler information about the solution
In the Instructions: “5. The longest kill streak is worth 2^N, where N is the number of kills of the streak”, so I’ve began with the idea, that only one player, with the longest kill streak, gets points, and the others get 0. And surely enough it doesn’t work. So, I got, every player becomes points for their streak nevertheless is it the best/longest result among all the players or not.
Maybe it’s better to determine “5. The kill streak is worth …”
And one more thing, in the Instructions: “Players with the same score should be sorted by the order they appear in the array.” So, at first, I’ve sorted the results with key = (score, position) in case there are more than one player with the same score. But then I tried and found out, that the sorting with key = score can pass all the test as well.
So maybe it’s better to dismiss this part of Instructions, or to add additional tests, where two players or more have the same result.
Thank you.
This solution is nice and short, but it is O(^2).
Exellent solution!!Nice code.
Javascript fork
chai
instead of the deprecated Codewars test framework, enabled JS Node v18for(var i = 2;i < Math.sqrt(n); i++)
changed tofor(var i = 2; i*i <= n; i++)
for accurate primality testingThis 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...