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.
Your solution is the only correct one in all of the solutions I have seen; because others rely on the precision of the float which gives wrong results with big numbers.
But your solution is inefficient with large numbers. At least better than giving wrong results.
This is because the difference between two consecutive perfect squares is always odd. If you have a number n, then n+1 squared is: (n+1)^2 = n^2+2n+1. If you subtract n^2, our original number, you get n^2+2n+1-n^2 = (n^2-n^2)+ 2n + 1 = 2n+1. Any number of the form 2n+1 is odd, so the difference must always be an odd number.
Whoa. Is there a name for the rule that this is expressing?
This comment is hidden because it contains spoiler information about the solution