Skip to content

Instantly share code, notes, and snippets.

Created May 26, 2022 07:24
What would you like to do?
this is the solution to the cats and mouse problem in hackerrank.
function catAndMouse(x, y, z) {
const diffA = Math.abs(z-x);
const diffB = Math.abs(z-y);
if(diffA === diffB) return "Mouse C";
return diffA < diffB ? "Cat A" : "Cat B";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment