Algorithm · LinkedIn · Medium
Given a positive integer n, decide whether there exists an integer k such that k * k == n. A number with this property is called a perfect square. Your solution must not call any built-in square-root function or any library routine that computes roots or powers. The expected time complexity is $$O(\log n)$$. The input is a single integer n. Return true exactly when n is a perfect square, otherwise return false. Example 1: Explanation: $$5 \times 5 = 25$$, so 25 is a perfect…
Checking your access…