Skip to content
Discussion options

You must be logged in to vote

We need to determine which of two people (Person 1 or Person 2) reaches a third person (Person 3) first when both are moving towards Person 3 at the same speed. The solution involves comparing the distances each person has to travel to reach Person 3. The person with the shorter distance will arrive first. If both distances are equal, they arrive at the same time.

Approach

  1. Calculate Distances: Compute the absolute difference between the positions of Person 1 and Person 3 (|x - z|) and the absolute difference between the positions of Person 2 and Person 3 (|y - z|). This gives the distance each person needs to travel.
  2. Compare Distances: Compare the two distances:
    • If the distance of Perso…

Replies: 1 comment 2 replies

Comment options

mah-shamim
Sep 4, 2025
Maintainer Author

You must be logged in to vote
2 replies
@kovatz
Comment options

kovatz Sep 4, 2025
Collaborator

@mah-shamim
Comment options

mah-shamim Sep 4, 2025
Maintainer Author

Answer selected by kovatz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested easy Difficulty
2 participants