Ad
  • Custom User Avatar

    That doesn't solve the problem, you want the path to start and end at the same point, what you're doing would return true for a path like this: ['n','n','n','n','n','n','n','n','n','n'] where you can easily see you end at ten blocks from where you started.

  • Custom User Avatar

    I am a bit confused. I split the array into 2 - one with the first 5 directions and the other with the last five. Then I reversed the array for the first five and compared it with the last five - "to return to the same direction". I am getting an error on the last test case (should return true if walk is valid). Why is this?