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.
In Go v1.20, the slices package doesn't exist, and sort.Slices isn't available for []int either, so it's best to rely on the other functions in the sort package instead. I ended up wasting a lot of time figuring this out.
Fixed Coffeescript and Ruby 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.
Nice Kata, but for C# I think it's more of a 7 kyu. If you don't know some very specific System.Linq functions, doing it the old fashioned way adds a lot of complexity. Anyway, thanks, those functions are very handy.
Haskell translation
Done (by me again ~~
:-)
Reworded
Loading more items...