Ad
  • Custom User Avatar

    OP solved it, closing

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Thank you. Now I understand ;)

  • 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.

  • Custom User Avatar

    Hello I have problem with:

    ['NORTH', 'NORTH', 'EAST', 'SOUTH', 'EAST', 'EAST', 'SOUTH', 'SOUTH', 'SOUTH', 'NORTH']

    My output:
    ['EAST', 'EAST', 'EAST', 'SOUTH']

    Should be:
    ['NORTH', 'NORTH', 'EAST', 'SOUTH', 'EAST', 'EAST', 'SOUTH', 'SOUTH']

    Could you please explain me why mine is not correct?