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, pointiis at coordinates(xi, yi). - All points move simultaneously and continuously.
- Each point moves with constant speed
v = 1. - At any time
t, pointimoves 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:
- The meeting time
T. - The meeting position
(X, Y).
If they do not meet, output NEVER.
Input
- Integer
N(2 ≤ N ≤ 200) Nlines of real numbers:xi yi
Output
- Either
NEVER, or three real numbersT X Y.
Requirements / Notes
- Your numeric outputs should be within
1e-4absolute 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 →