You are viewing a single comment's thread. Return to all comments →
Optimized Needs only two abs() function calls.
static String catAndMouse(int x, int y, int z) { int xDist=Math.abs(x-z); int yDist=Math.abs(y-z); return xDist<yDist ? "Cat A": xDist>yDist ? "Cat B":"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 →
Optimized Needs only two abs() function calls.