You are viewing a single comment's thread. Return to all comments →
Here is my C++ solution :
string catAndMouse(int x, int y, int z) { int diffA = abs(z - x); int diffB = abs(z - y);
if(diffA < diffB) { return "Cat A"; } else if(diffB < diffA) { return "Cat B"; } else { return "Mouse C"; }
}
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 →
Here is my C++ solution :
string catAndMouse(int x, int y, int z) { int diffA = abs(z - x); int diffB = abs(z - y);
}