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 problem can be frustrating if you don't grasp the pattern in the solutions. It tests your problem-solving skills rather than coding skills. As a data scientist or even as a developer, having strong problem-solving abilities will ultimately lead to more efficient coding.
As others have pointed out, the optimal choice for each player is to reduce the tower's height by m-1, resulting in a new tower with a height of 1. Since 1 evenly divides any number, the constraint is satisfied. The peculiar wording of the constraint was indeed a clue to guide you towards this solution.
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 problem can be frustrating if you don't grasp the pattern in the solutions. It tests your problem-solving skills rather than coding skills. As a data scientist or even as a developer, having strong problem-solving abilities will ultimately lead to more efficient coding.
As others have pointed out, the optimal choice for each player is to reduce the tower's height by m-1, resulting in a new tower with a height of 1. Since 1 evenly divides any number, the constraint is satisfied. The peculiar wording of the constraint was indeed a clue to guide you towards this solution.