Amazon Interview Question
Software Engineer / DevelopersTeam: RCX
Country: United States
Interview Type: In-Person
Question is this i think:
Given there are two robots and they are on two special points on a railway track. The robots need to be programmed with a micro chip. The code in the two chips will be the same. The robots support only these three operations
1. Move Left
2. Move Right
3. Is Special Point : Returns true if any robot is at this point and these are the starting points where robots stand initially.
Make the robots meet?
If the sensor is not between the 2 robots, it's pretty simple. Make them move in 1 direction say left or right till they meet the sensor. When they reach the sensor stop, eventually they will meet.
Case 2:
If sensor between 2 robots:
Move Left
if(sensor)
speed=speed*2;
They will meet this way as well...
- nim January 08, 2012