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.
This comment is hidden because it contains spoiler information about the solution
Math.sqrt() will give us decimals that aren't equal to zero if the number in its parameter is not a perfect square. So, when it goes through the ternary statement below it, it will go to the false section immediately and return -1.
Also, adding one is only going to help us if 'sq' is a perfect square, otherwise, it's not going to change anything (i.e. if the number isn't a perfect square).
You kind of need to look at it upside down and disect it a little bit.
Hope this helps.
This comment is hidden because it contains spoiler information about the solution
It took me a second, but this is brilliant.
Clever girl
This comment is hidden because it contains spoiler information about the solution
I don't undertand how this works. Could someone please explain?