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 just got it now!
If we store the result of std::sqrt(n) in an int it will disregard the potential decimal numbers (which means the input parameter is not a perfect square to begin with).
However, storing the result of std::sqrt(n) in an int works for this problem because if you multiply the values stored in the int variable by itself it will NOT equal to the input parameter because the decimal numbers have been taken off. Hence why the function will return false if the input parameter is NOT a perfect square.
I don't quite understand why this is accepted? If the square root of n results in a decimal number, then n is not considered a perfect square correct? (and so the function should return false)
But if we simply store the result of std::sqrt(n) in an int type variable then that disregards the potential decimal digits returned by std::sqrt(n).