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.
Agree. I see a lot of comments here on Codewars with folk saying "use <xyz> it's faster" where one or more of the following are true:
To that last point I profiled this kumite just for a laugh, running this version and the previous over an array of 10 million random integers. Here's a typical case:
In most cases this new
&
logic was actually a touch slower, almost always within the variance between runs, but the more salient point is that both implementations are far faster than you'll likely ever need, and will both be dwarfed in runtime by any other significant process - an obvious example is the garbage collector.If you find yourself needing this kind of optimisation (you won't) then you're already using the wrong language.
sorry, but this is premature optimization (https://effectiviology.com/premature-optimization)
it's not as readable as the solution you had before and optimitations like this
should be justified not just by saying "it's faster" ... it's very likely
the classic number % 2 == 0 is not your problem if you have to do a performance optimization.
thanks for this tip.
Too much code for that simple task, these final fields are unnecessary
too much code
I think this is great
A problem with your code is not a kata issue, read this: https://docs.codewars.com/training/troubleshooting#print-input
This comment is hidden because it contains spoiler information about the solution
You should return only the 2 first elements of the sequence when n is 2. It doesn't matter the signature has 3 elements. Not a kata issue.
This comment is hidden because it contains spoiler information about the solution
too much ifs
Read the description again, use the unit's worth value. The expected result is correct. Not a kata issue.
I have a problem with this test in Java
"Forces of Good: [7244 5221 8319 4714 4244 6602]
Forces of Evil: [5036 3102 9543 9343 4080 1248 6957]
==> expected: Battle Result: Good triumphs over Evil> but was: Battle Result: Evil eradicates all trace of Good> "
I dont know why test should be expected good triumfs, I counted on the calculator and evil had more points.
Not a kata error, all is said.
ok, thanks
Loading more items...