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
|
1259 Discussions
|
Please Login in order to post a comment
A Short and Easy C# Solution using Ternary operator With Time and Space Complexity of O(1).
Here is my c++ solution, you can watch the explanation here : https://youtu.be/vbV5-DqJU74
Short version
Here is the solution for C#
int res = Comparer.Default.Compare(Math.Abs(x-z),Math.Abs(y-z));
return res < 0 ? "Cat A" : res > 0 ? "Cat B" : "Mouse C";
Solution from my side for this problem
JS, Javascript Solution:-