• + 0 comments

    JS, Javascript Solution:-

    function catAndMouse(x, y, z) {
        const aMDistance = Math.abs(x-z)
        const bMDistance = Math.abs(y-z)
        if (aMDistance === bMDistance) return "Mouse C"; else if (aMDistance > bMDistance) return 'Cat B';
        return 'Cat A';
    }