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.
Fixed Coffeescript too.
Your function doesn't return the sorted array. Read this: https://docs.codewars.com/training/troubleshooting
Well done, thank you!
mine don't either
Javascript, that seems to be the original language generates arrays without repetitions, so,
I've fixed Python translation to do the same, I think other languages should be checked as well, just to be sure.
Adapting the description is also an option, if it was intended that non-ascending and non-descending are allowed.
However, I think that would make the kata even more difficult for arrays that would contain all equal values.
Otherwise I think random tests should generate arrays that match the description (which is not THAT hard...)
So, do you think adding monotonically would make it better? Or changing ascending for non-descending and viceversa? The other way to resolve this, would be making sure there are no repeated numbers in each of those arrays. At least in Python, there is no guarantee that the lists don't have duplicates in random tests.
I didn't mention it's not sorted. I mentioned it's not descending. It's non-ascending. Which is something completely different.
You can check any mathematical reference on this.
Why do you say it's not sorted? Because it is, it's not strictly descending, but it is descending.
(in C only?)
Description says that arrays are either ascending or descending, but random test has this array:
which is NOT a descending or an ascending array.
Got the answer, kept for posterity to clarify the rule on defender bonus calculation:
"M attack. R Power 4. R wins
Go to the trench
P has power 3 of the L team. It gets the trench defense bonus 6 so it wins. 2 remains after the successful defense.
2 points is less than the original 3 so it keeps 2 power
It overpowers first s and losses 1 power point keeping 1.
Overcomes the second s with a draw and retreats. The next s wins its position"
Can someone explain why with this input:
the expected output is
R|LLLR
(notR|LLLL
)?thanks!
fixed
C translation issue:
incorrectly expects p(0)==2
Loading more items...