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.
This comment is hidden because it contains spoiler information about the solution
If you're on codewars to argue efficiency, you're probably in the wrong place.
Premature optimization is the root of all evil - elegance and simplicity hold infinitely more value here.
It would've been nice if the tests given in the instructions were also given in the tests window. Not nice to have to write the tests out yourself if they could already have been given.
The function name
knight
doesn't seem very representative of its function output. How about renaming itknight_moves
instead?Interesting problem and otherwise good kata!
Not so much a programming problem as much as an arduous data entry task. Perhaps add the map with data to the sample code already.
This kata is rather badly worded. It's not checking for monotonic sequences. If that was the case,
[3,2,1]
should returnTrue
as well.It's checking for:
And for that condition,
[0, 1, 0]
is true.Perhaps take it up with the author of the kata?
This is true for
[0, 1, 0]
. My function returnsTrue
. I don't see your problem.