Ad
  • Custom User Avatar

    Alr raised above

  • Custom User Avatar

    Read what dulot wrote up there.

  • Default User Avatar

    @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

  • Custom User Avatar

    Kind of Puzzle Bobble ;)

  • Default User Avatar

    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.

  • Default User Avatar

    I quote a post by @Unnamed (see below in the Discourses):

    Only adjacent directions should be reduced. It's like considering curvature of the Earth. Or maybe going down a spiral staircase where you end up in a different layer.

    Nobody told you that you are on a "Cartesian Plane".

  • Custom User Avatar

    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 :)

  • Custom User Avatar

    Don't overthink it, just follow the instructions, even if you don't agree with them.

  • Custom User Avatar

    Don't forget to mention it's in Haskell.

  • Custom User Avatar

    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.