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.
Alr raised above
Read what dulot wrote up there.
@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
Kind of Puzzle Bobble ;)
Think of NORTH, SOUTH, WEST, EAST as chemical products. When NORTH and SOUTH or WEST and EAST are side by side they annihilate each other; they don't if they are separated by another element.
I quote a post by @Unnamed (see below in the Discourses):
Nobody told you that you are on a "Cartesian Plane".
Hey, CSDUMMI.
The problem statement only wants you to cancel out opposite directions when they are adjacent in the list. It is true that the path "North East South West" ends up at the beginning, but since the "South" direction is not directly next to the "North" direction, the problem wants you to ignore it. If the path was "North South East West", you could simplify it because the opposite directions are next to each other.
Hope that helps explain it a little bit better :)
Don't overthink it, just follow the instructions, even if you don't agree with them.
Don't forget to mention it's in Haskell.
It is not a hard kata, but it teaches some interesting things about strings and number sorting in the languages where data types are strict.