Ad
  • Custom User Avatar

    Imagine you go through a maze, UP, LEFT, DOWN, RIGHT would not be the same as standing still as you may be on the other side of the wall now for example.

    However if you'd go UP and then DOWN immediatly, you'd be in exactly the same spot, thus wasting effort.

    The problem is if you add walls and streets than going WEST or EAST after NORTH or SOUTH may open up different paths, so they don't cancel out.

    also as Chrono mentions, NORTH EAST is not the same as EAST NORTH, the path matters, maybe NORTH EAST is safe but EAST NORTH is not safe (maybe it crosses hostile territory or swamps or desert).

  • Custom User Avatar

    Read the instructions again, you only reduce opposite directions when they're next to each other (and it's being explained several times before). The task is not "find the minimal path" as you think it is.

    Additional it is a not sense that the solution [NORTH, EAST] can be valid, but the solution [EAST, NORTH] is not equivalent and so not valid

    While you reach the same point, the path is different.