• + 0 comments

    Explanation of what the algorithm is actually doing.

    For any number there will always be a pair of factors, a and b, for that number. Example for 24: 1&24, 2&12, 3&8, 4&6.

    Due to this, the result will by default be an even number. However the only exception is when a number has an integer square root, as the root is only counted once towards the factors.

    So the problem finds the integer root and checks if that root squared is equal to the original number. If so, then the answer is YES.