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.
Cats and a Mouse
Cats and a Mouse
Sort by
recency
|
1253 Discussions
|
Please Login in order to post a comment
if abs(x-z)==abs(y-z): return "Mouse C" elif(abs(x-z)>abs(y-z)): return "Cat B"
else: return "Cat A"
Here is my c++ solution, you can watch the explanation here : https://youtu.be/vbV5-DqJU74
Short version
Python solution
Here is my C++ solution :
string catAndMouse(int x, int y, int z) { int diffA = abs(z - x); int diffB = abs(z - y);
}