Veson Nautical Interview Question: Given two robots on an infini... | Glassdoor

Interview Question

Software Development Intern Interview(Student Candidate) Boston, MA

Given two robots on an infinite line of integers, with a

  flag guaranteed to be between them, write a behavior for both robots to follow which will guarantee them to eventually meet. The robots can only "see" the position they are standing on, and can't remember anything. Also note that they can't tell if they are the leftmost or rightmost robot. They can tell if they are on the flag or the other robot. They may move right, move left, or wait.

Interview Answer

1 Answer


The answer involved moving both robots to the right (or left) until one of them encounters the flag, at which point it would increase its speed (move twice instead of moving then waiting) until it caught up with the other bot.

Interview Candidate on May 1, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.