Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
devagya, please use spoiler flag next time.
It can be, but plenty of compilers will optimize a divide-by-two into a shift anyway. (Specifically any divide-by-power-of-two can be turned into a single shift)
Yes, bit operating is faster
This comment is hidden because it contains spoiler information about the solution
Same :D
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.return the count
Do I have to return a table as the example shows?
The usual wording in math problems like this would be "non-negative". The description could either make an exception for
0
, or just change "positive" to "non-negative" and give a clear example.0 is neither positive or negative, so...
0
just can't be positive in standard math, so it has to be reworded somehow instead.NASM Translation
Wonder if this is really a best practice, although it completely satisfies the task... Well done.