Seoul Robotics Interview Question

Algorithm so solve real problem