二分。

    bool isPerfectSquare(int num) {if (num == 0 || num == 1)return true;int start = 0;int end = num;while (start <= end) {int chu = start + (end - start) / 2;int res = num / chu;if (res == chu && num % chu == 0)return true;if (chu > res)end = chu - 1;elsestart = chu + 1;}return false;}

转载于:https://www.cnblogs.com/willaty/p/8436009.html

leetcode 367. Valid Perfect Square相关推荐

  1. [leetcode] 367. Valid Perfect Square

    Given a positive integer num, write a function which returns True if num is a perfect square else Fa ...

  2. 367. Valid Perfect Square

    题目: Given a positive integer num, write a function which returns True if num is a perfect square els ...

  3. C#LeetCode刷题之#367-有效的完全平方数(Valid Perfect Square)

    问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/3869 访问. 给定一个正整数 num,编写一个函数,如果 num ...

  4. LeetCode Valid Perfect Square(是否是平方数)

    题意:给出一正整数,不用 sqrt函数,判断该数是否是平方数 思路: 第一种,连续奇数和为平方数 代码如下: public class Solution {public boolean isPerfe ...

  5. Leetcode 279. Perfect Square

    Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 1 ...

  6. 【To Do! 重点 正则表达式】LeetCode 65. Valid Number

    LeetCode 65. Valid Number 本博客转载自:[1]http://www.cnblogs.com/yuzhangcmu/p/4060348.html [2]https://blog ...

  7. 【回文串14】LeetCode 680. Valid Palindrome II

    LeetCode 680. Valid Palindrome II Solution1:我的答案 复杂度是O(n)O(n)O(n),不算好啊.. 注意:对于c++中string对象常用的insert( ...

  8. 【回文串3】LeetCode 125. Valid Palindrome

    LeetCode 125. Valid Palindrome Solution1:我的答案 复杂度为O(n)O(n)O(n),写法不是很简练啊. class Solution { public:boo ...

  9. LeetCode 36. Valid Sudoku

    LeetCode 36. Valid Sudoku Solution1:我的答案,比较笨.但是清晰易懂好上手啊~~~ class Solution { public:bool isValidSudok ...

最新文章

  1. 你必须了解的微服务架构设计的10个要点!
  2. Apache理论与实战
  3. quartz 动态添加job_SpringBoot+Quartz实现动态管理定时任务
  4. 操作系统(十五)调度算法的评价指标
  5. docker部署tomcat+mysql服务
  6. Codeforces274B
  7. mysql innodb表移植_mysql Innodb引擎独立表空间下通过复制.ibd文件快速迁移数据文件...
  8. Ta Muid(Dreams 梦幻)
  9. Cover Protocol更新赔偿计划 新增三个新COVER代币获赔方
  10. ssas_通过SSAS透视图提高可读性
  11. Java-重载、重写(冷静分析)
  12. 【语音合成】基于matlab重叠相加法的信号分帧与还原【含Matlab源码 568期】
  13. Flutter基础学习(一)Dart语言入门
  14. Pytorch训练问题:AssertionError: Invalid device id
  15. OSPF NBMA实验(单播、广播)
  16. OSPF的五类LSA概述
  17. 此计算机无法与域 cluster,创建0xc000005e群集时出现错误 - Windows Server | Microsoft Docs...
  18. java计算机毕业设计高校体育器材及场地管理MyBatis+系统+LW文档+源码+调试部署
  19. 下载Stani‘s Python Editor
  20. SAX 方式解析 XML

热门文章

  1. html_5_小作业1_超链接练习
  2. [BUUCTF-pwn]——wustctf2020_getshell
  3. [BUUCTF-pwn]——[第六章 CTF之PWN章]stack
  4. linux mint 无法联网_Linux Mint系统安装后WiFi不可用的解决办法
  5. java 中格式化小数位数
  6. Google Guava 库用法整理
  7. 2分钟学会ajax 入门ajax必备
  8. 201712-1最小差值
  9. openstack系列文章(二)
  10. Java多线程之捕获异常