Move one step at a time to correctly handle obstacles At every step, we calculate the squared distance from origin and keep track of the maximum.