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.
This is a trick test. The height of the towers is almost irrelevant, since P1 always plays first and plays optimally they will always win when there's an odd number of towers, while P2 always wins when there's an even number of towers.
The only exception to this rule is if m == 1, in that case P1 won't have a move to begin with and P2 wins.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Tower Breakers
You are viewing a single comment's thread. Return to all comments →
This is a trick test. The height of the towers is almost irrelevant, since P1 always plays first and plays optimally they will always win when there's an odd number of towers, while P2 always wins when there's an even number of towers.
The only exception to this rule is if m == 1, in that case P1 won't have a move to begin with and P2 wins.