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.
I made this a long time ago. But if I remember correctly, the distance from from cell 1 to cell 2 must always be computed not by abs(x2-x1) + abs(y2-y2) but instead more precisely with pythagorean's theorem sqrt((x2-x1)^2 + (y2-y1)^2)
Using this formula, the distance of the three spaces in your example from the target or start would be 2, ≈1.41, and 2.
So if i remember the kata correctly, the correct answer is the middle one of those three or (1,1) because it is the closest box within the circle of radius = 2 to the target box (2,2)
This comment is hidden because it contains spoiler information about the solution
Yes, if the argument is a very large number.
But the function correctly handles the case where n <= math.maxinteger, which should be enough.
Fixed.