Ad
  • Custom User Avatar

    Given that the task is very specific I'd say it is, as it is performant and the code is readable.

    If you had to, for example, generate neighbors up to a variable distance n received as a parameter of the function, that would be a different story.

  • Custom User Avatar

    Wonder if this is really a best practice, although it completely satisfies the task... Well done.