Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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).
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.
While you reach the same point, the path is different.
@MattZ306 you said that "you could simplify it because the opposite directions are next to each other" but the example given in the instructions is contradicting you
For the path ["NORTH", "SOUTH", "SOUTH", "EAST", "WEST", "NORTH", "WEST"] in the example inside the instructions the solution is said to be ["WEST"]
But if you can simplify only if opposite directions are next to each other the solution should be ["SOUTH", "NORTH", "WEST"] because the second SOUTH is not closer to the second NORTH
There are problems on the solution paths.
If the original path is [NORTH, WEST, SOUTH, EAST] the right minimal path is an empty array and not the array [NORTH, WEST, SOUTH, EAST]
And if the original path is [SOUTH NORTH NORTH SOUTH EAST SOUTH WEST EAST SOUTH WEST] the minimal path is [SOUTH SOUTH] but I receive the error array lengths differed, expected.length=2 actual.length=4
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