美文网首页
367. Valid Perfect Square

367. Valid Perfect Square

作者: 我是你的果果呀 | 来源:发表于2016-12-22 06:20 被阅读0次

Given a positive integernum, write a function which returns True ifnumis a perfect square else False.

Note:Do notuse any built-in library function such assqrt.

Example 1:  Input: 16  Returns: True

Example 2: Input: 14   Returns: False

除了1 以外, 所以数的平方跟都小于等于这个数的二分之一, 二分查找法

相关文章

网友评论

      本文标题:367. Valid Perfect Square

      本文链接:https://www.haomeiwen.com/subject/ctycvttx.html