A mason has num square tiles. He wants to lay them as a bigger solid square, with the same number of tiles along each side. There must be no gap and no tile left over.
Return true if this is possible, and false if it is not. In other words, check whether num is a whole number multiplied by itself, like 9 = 3 x 3.
You may not use any built-in root function, such as sqrt.
Examples
Example 1:
Input: num = 49
Output: true
Explanation: 7 tiles along each side use 7 x 7 = 49 tiles.
Example 2:
Input: num = 50
Output: false
Explanation: 7 x 7 is 49 and 8 x 8 is 64. No whole number multiplied by itself gives 50.
Example 3:
Input: num = 15129
Output: true
Explanation: 123 x 123 is 15129.