This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
1. Initialize left=1 & Right=n | |
2. Calculate mid = Math.floor((left + right) / 2); | |
2. If mid*mid = n, then n is Perfect Square | |
3. Else if mid*mid > n then right = mid - 1 | |
4. Else if mid*mid < n then left = mid + 1 | |
*/ | |
const perfectSquare = (number) => { |