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.
public static int towerBreakers(int n, int m) {
// Write your code here
int result=0;
if(m==1){
result=2;
}else{
if(n==1){
result=1;
}else{
if(n%2==0){
result=2;
}else{
result=1;
}
}
}
return result;
}
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 →
public static int towerBreakers(int n, int m) { // Write your code here int result=0; if(m==1){ result=2; }else{ if(n==1){ result=1; }else{ if(n%2==0){ result=2; }else{ result=1; } } } return result;