• + 0 comments

    Here is my C++ solution :

    string catAndMouse(int x, int y, int z) { int diffA = abs(z - x); int diffB = abs(z - y);

    if(diffA < diffB)
    {
        return "Cat A";
    }
    else if(diffB < diffA) 
    {
        return "Cat B";
    }
    else {
        return "Mouse C";
    }
    

    }