You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Given a positive integer num, return <code>true</code> <em>if</em> <code>num</code> <em>is a perfect square or</em> <code>false</code> <em>otherwise</em>.</p>
2
+
3
+
<p>A <strong>perfect square</strong> is an integer that is the square of an integer. In other words, it is the product of some integer with itself.</p>
4
+
5
+
<p>You must not use any built-in library function, such as <code>sqrt</code>.</p>
6
+
7
+
<p> </p>
8
+
<p><strongclass="example">Example 1:</strong></p>
9
+
10
+
<pre>
11
+
<strong>Input:</strong> num = 16
12
+
<strong>Output:</strong> true
13
+
<strong>Explanation:</strong> We return true because 4 * 4 = 16 and 4 is an integer.
14
+
</pre>
15
+
16
+
<p><strongclass="example">Example 2:</strong></p>
17
+
18
+
<pre>
19
+
<strong>Input:</strong> num = 14
20
+
<strong>Output:</strong> false
21
+
<strong>Explanation:</strong> We return false because 3.742 * 3.742 = 14 and 3.742 is not an integer.
22
+
</pre>
23
+
24
+
<p> </p>
25
+
<p><strong>Constraints:</strong></p>
26
+
27
+
<ul>
28
+
<li><code>1 <= num <= 2<sup>31</sup> - 1</code></li>
0 commit comments