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.
Though you have solved it, but I would like to suggest you consider
console.log
as your best friend and watch out for edge cases by re-reading the description several times. Kudos ^^I got 101 passed test cases and only failed 3, I have confirmed that my logic is correct. It's impossible to know why those 3 test cases failed without providing the input walk array for the respective test cases.
In JavaScript console.log(array) can be used for this purpose. I don't know about other languages
try putting the rooks on a (possibly virtual) chessboard for a small
n
(2, 3 or 4) and see how you would count the positions if you were to do it manually. you should be able to notice how the position of one rook determines that of the rook on the next rank or filehow does checking the arrays truthy value not meet the condition if the arr has a length greater than 1?
For the life of me I could not figure out a solution yet alone an elegant one, is anyone able to give me hints/tips? I don't think this is a 7kyu kata, I might be wrong though.
This Kata would benefit greatly with an example of the failed test case, instead of the expected equal alone. The basic test case is not enough for this Kata.