Ad
  • Default User Avatar

    Bro it is stated it should be in a type of sequence you can understand the condition by the below example.
    for example [North,East ,West, South] then since east west are in sequence they are eliminated first ->
    The Array is reduced as [North South] Again North South are in sequence so the will be eliminated so
    Final result is An empty array

  • Custom User Avatar

    It is not stated that they need to be in sequence or out of sequence, in some cases the result considers directions that aren't in sequence but somehow dont reduce this occurance

  • Custom User Avatar

    Man you for real? You have NxM iterations of linear operation "in"

  • Custom User Avatar

    That is if the task is to reduce the steps to the most optimal.

    The actual task is:

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

    From, NWSE. There's no WE, EW, SN, or NS. Which means, you don't need to reduce it.