← All problemsSign in

3516. Find Closest Person

LeetCodeMathOpen on judge ↗

You are given three integers x, y, and z, representing the positions of three people on a number line: - x is the position of Person 1. - y is the position of Person 2. - z is the position of Person 3, who does not move. Both Person 1 and Person 2 move toward Person 3 at the same speed. Determine which person reaches Person 3 first: - Return 1 if Person 1 arrives first. - Return 2 if Person

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start