Ad
  • Custom User Avatar

    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 ^^

  • Custom User Avatar

    In JavaScript console.log(array) can be used for this purpose. I don't know about other languages

  • Default User Avatar

    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 file