cswork / libraryOpen practice workspace

Interview questions · Disney

Determine if chasing points will meet

This question evaluates understanding of pursuit curves, continuous dynamical systems, computational geometry, and numerical simulation, measuring the ability to reason about concurrent motion, convergence behavior, and numerical precision when multiple agents chase one another.

You are given N points in 2D, indexed 0..N-1, forming a cycle.

  • At time t = 0, point i is at coordinates (xi, yi).
  • All points move simultaneously and continuously.
  • Each point moves with constant speed v = 1.
  • At any time t, point i moves in the direction of the current position of point (i+1) mod N (i.e., it “chases” the next point).

Task

Write a program that determines whether the points will all meet at the same location at the same time.

If they do meet, output:

  1. The meeting time T.
  2. The meeting position (X, Y).

If they do not meet, output NEVER.

Input

  • Integer N (2 ≤ N ≤ 200)
  • N lines of real numbers: xi yi

Output

  • Either NEVER, or three real numbers T X Y.

Requirements / Notes

  • Your numeric outputs should be within 1e-4 absolute error.
  • You may use numerical simulation (time-stepping) as long as it meets the error requirement and runs efficiently.

Community answers

Nothing here yet.

Join in on CSWork →