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.
// Write your code here/* If m == 1, the towers are all of height 1 -> No moves possible -> Player 1 loses, so return 2 If n is even, whatever move Player 1 makes, -> Player 2 can mirror it on another tower -> Player 2 wins -> return 2 If n is odd and m > 1, -> Player 1 can always win -> return 1 */if(m==1||n%2==0){return2;}else{return1;}}
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 →