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.
now i passed 1 but failed 1 still.
error:
Expected: 0, instead got: undefined
. i was returning 0
if (array == null || array === 1 ) {
return 0;
}
not sure about the issue
Change
return a>b
toreturn b-a
and you should be good :). You should always sort an array based on their value and not a comparsion of their values. Otherwise it will act on their Boolean value (true or false), since it's a comparsion operator, and will not sort based on their actual value. See more here.This comment is hidden because it contains spoiler information about the solution