Class Solution

java.lang.Object
g0301_0400.s0367_valid_perfect_square.Solution

public class Solution extends Object
367 - Valid Perfect Square.<p>Easy</p> <p>Given a <strong>positive</strong> integer <em>num</em>, write a function which returns True if <em>num</em> is a perfect square else False.</p> <p><strong>Follow up:</strong> <strong>Do not</strong> use any built-in library function such as <code>sqrt</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> num = 16</p> <p><strong>Output:</strong> true</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> num = 14</p> <p><strong>Output:</strong> false</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= num <= 2^31 - 1</code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • isPerfectSquare

      public boolean isPerfectSquare(int num)