Ad
  • Custom User Avatar

    OP solved it, closing

  • Custom User Avatar

    You're cancelling each NORTH with SOUTH and each EAST with WEST, and it's not that simple, you have to do that when they're next to each other:

    Write a function dirReduc which will take an array of strings and returns an array of strings with the needless directions removed (W<->E or S<->N side by side).

    A rephrase of the instructions if you want (by dulot):

    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.

    And you have to do it as many times as it's needed.