3516: Find-Closest-Person
Easy


table of contents

The question is solveable with a few conditional statements.

code

class Solution {
public:
    int findClosest(int x, int y, int z) {
        return abs(x-z) == abs(y-z) ? 0 : (abs(x-z) < abs(y-z) ? 1 : 2);
    }
};

complexity

time taken