We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Why is that all players have to reduce the towers to 1 everytime they play? There is also an option to reduce the towers to a number (y) that can evenly divide the tower height (x)...
This had me confused a bit as well but I figured it out.
When the number of towers is even, P2 can just copy P1's move, not matter what it is and will always win, it not necesary to lower the tower to 1 in the first move.
When the number of towers is odd, if P1 lowers one tower to 1 that tower is out of the game and we are now in a even tower situation with the players reversed, so from now on P1 just has to copy P2 to win the game.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Join us
Create a HackerRank account
Be part of a 26 million-strong community of developers
Please signup or login in order to view this challenge
Tower Breakers
You are viewing a single comment's thread. Return to all comments →
Why is that all players have to reduce the towers to 1 everytime they play? There is also an option to reduce the towers to a number (y) that can evenly divide the tower height (x)...
This had me confused a bit as well but I figured it out. When the number of towers is even, P2 can just copy P1's move, not matter what it is and will always win, it not necesary to lower the tower to 1 in the first move. When the number of towers is odd, if P1 lowers one tower to 1 that tower is out of the game and we are now in a even tower situation with the players reversed, so from now on P1 just has to copy P2 to win the game.