mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
19 lines
592 B
HTML
19 lines
592 B
HTML
|
<p>Given a <strong>positive</strong> integer <i>num</i>, write a function which returns True if <i>num</i> is a perfect square else False.</p>
|
||
|
|
||
|
<p><b>Follow up:</b> <b>Do not</b> use any built-in library function such as <code>sqrt</code>.</p>
|
||
|
|
||
|
<p> </p>
|
||
|
<p><strong>Example 1:</strong></p>
|
||
|
<pre><strong>Input:</strong> num = 16
|
||
|
<strong>Output:</strong> true
|
||
|
</pre><p><strong>Example 2:</strong></p>
|
||
|
<pre><strong>Input:</strong> num = 14
|
||
|
<strong>Output:</strong> false
|
||
|
</pre>
|
||
|
<p> </p>
|
||
|
<p><strong>Constraints:</strong></p>
|
||
|
|
||
|
<ul>
|
||
|
<li><code>1 <= num <= 2^31 - 1</code></li>
|
||
|
</ul>
|