Ad
  • Custom User Avatar

    there is a check earlier in the code to confirm the array provided is not empty

    Looking at your code, that check seems to happen too late. Why not take care of this case at the start of function?

  • Custom User Avatar

    It's most probably an exception thrown by at, when i is out of range of whatever the snail_map[leftRightCount] is. snail_map is not empty, but snail_map[leftRightCount] is smaller than i.