Ad
  • Default User Avatar

    I agree, I was able to pass the tests without fully functional code

  • Custom User Avatar

    Isnt coding about copy paste?
    I actually thought of trying to implement it. Would have been a great regEx paractice, but then... as you say its so easy to google it.

  • Custom User Avatar

    Well, exactly the same way how others did it with recursion! ;) Idea is to reduce the amount of identical recursive (or any other) calls and "merge" them somehow into a single one, no matter if it's done with recursion or not.

  • Default User Avatar

    Try to visualize the task in a cartesian coordinate system: (0,0) -> (1,0) -> (0,0) -> (-1,0) -> (-1,1) -> (-1,0) -> (0,0) -> (0,-1)

    arr[0]+arr[1] eliminate each other, then arr[3]+arr[4], resulting in South (arr[2]) and North (arr [5]) being next to each other, thus annihilating each other, which means that arr[6] "West" is the only entry, which doesn't cancel anything out in our given array.

  • Custom User Avatar

    Can't be changed.