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.
sqrt is calculated 2 times :(
Nice, it takes off the decimal and checks it aginst the actual case. Cool solution!
He's checking to see if the sqrt() function has decimals by comparing the base sqrt(n) to the rounded down version (floor()) of sqrt(n). If they are equal and the function returns true, then sqrt(n) must have no decimals. Thus, n is a perfect square.
why are you using floor specifically?
floor in C++
What does the function floor do?
This comment is hidden because it contains spoiler information about the solution
I am using a square root for this function. The best I could find was sqrtl() for a double long, but it is still not working on test 6. Does anyone know of a way to do sqrt for a long long?