Valid Perfect Square
https://leetcode.com/problems/valid-perfect-square/description/
Given a positive integer num, write a function which returns True if num is a perfect square else False.
Thoughts
和sqrt(x)同理. 只是这次无论是二分还是牛顿法得到的最终结果不是直接返回, 而是与自身相乘看是否与num相等.
Code
Analysis
时间复杂度未知.
Last updated
Was this helpful?