Seoul Robotics interview question

Algorithm so solve real problem