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.
static String catAndMouse(int x, int y, int z) {
String result = "Mouse C";
int catA = Math.abs(z - x);
int catB = Math.abs(z - y);
if (catA > catB) {
result = "Cat B";
}
else if (catA < catB) {
result = "Cat A";
}
return result;
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Cats and a Mouse
You are viewing a single comment's thread. Return to all comments →
java (8)