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.
n
Wonder if this is really a best practice, although it completely satisfies the task... Well done.
Loading collection data...
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.Wonder if this is really a best practice, although it completely satisfies the task... Well done.