难度:easy

Given an integer, write a function to determine if it is a power of three.

Follow up:
Could you do it without using any loop / recursion?

Credits:
Special thanks to @dietpepsi for adding this problem and creating all test cases

思路:判断一个整数是否为3的幂。用while循环让整数一直被3除,如果最后整数为1,则它就是3的幂。

leetcode 326 [easy]--- Power of Three相关推荐

  1. leetcode (Tree easy)

    leetcode Tree easy # leetcode Tree easy problem class TreeNode(object):def __init__(self,val):self.v ...

  2. LeetCode:326. Power of Three

    2019独角兽企业重金招聘Python工程师标准>>> Given an integer, write a function to determine if it is a powe ...

  3. LeetCode 326. Power of Three

    题目: Given an integer, write a function to determine if it is a power of three. Follow up: Could you ...

  4. [leetcode]326. Power of Three(c语言)

    题目 Given an integer, write a function to determine if it is a power of three. Follow up: Could you d ...

  5. LeetCode 326. Power of Three (算法,换底公式)

    Given an integer, write a function to determine if it is a power of three. Follow up: Could you do i ...

  6. leetcode 326. 3的幂(Power of Three)

    目录 题目描述: 示例 1: 示例 2: 示例 3: 示例 4: 进阶: 解法: 题目描述: 给定一个整数,写一个函数来判断它是否是 3 的幂次方. 示例 1: 输入: 27输出: true 示例 2 ...

  7. 【Leetcode】EASY题解....ing python

    文章目录 1. 两数之和[medium] 解题思路 代码 7. 整数反转[easy] 解题思路 代码 8. 字符串转换整数 (atoi)[M] 解题思路 代码 9.回文数 解题思路 代码 12. 整数 ...

  8. LeetCode 326. 3的幂

    1. 题目 给定一个整数,写一个函数来判断它是否是 3 的幂次方. 示例 1: 输入: 27 输出: true示例 2: 输入: 0 输出: false示例 3: 输入: 9 输出: true示例 4 ...

  9. 【LeetCode】231. Power of Two

    题目: Given an integer, write a function to determine if it is a power of two. 非常简单的一道题目 class Solutio ...

  10. LeetCode # Array # Easy # 217. Contains Duplicate

    Given an array of integers, find if the array contains any duplicates. Your function should return t ...

最新文章

  1. wxpython有没有可视化设计_wxPython - GUI Builder工具( GUI Builder Tools)
  2. sed替换每行最后一个字符
  3. 超详细派克斯使用安装教程
  4. Linux下的权限掩码umask
  5. 在IDEA 中用maven创建web项目
  6. [导入]MsAjax Lib- Boolean.parse 函数
  7. 【Android 逆向】Android 权限 ( ro.product.cpu.abi 属性 | ro.zygote 属性 | dhcp.eth0 属性 | net.* 属性 )
  8. swift SDWebImage 与 UIButton 出现的细节bug 不显示
  9. C++ const对象
  10. shell脚本,结合expect给当前网段所有主机分发任意文件
  11. Hibernate的延迟加载问题
  12. 中小型软件项目开发一般流程建议
  13. 家长进课堂 计算机ppt,【家长进朴园】探秘计算机—5.7中队家长进课堂活动
  14. amd显卡用黑苹果输出黑屏_黑苹果XFX讯景显卡刷vBIOS教程,使其黑苹果显卡更稳定完美,不再黑屏...
  15. JavaScript 正则表达式
  16. WPF学习笔记--插入本地链接、url链接
  17. Certbot的使用
  18. ITM Architecture/ ITM 架构
  19. bindiff 太慢,两小时没结果
  20. ubuntu16.04登录界面输入用户名密码后又回到登录界面

热门文章

  1. python爬取genek视频_【Python】爬虫(Xpath):批量爬取站长免费简历
  2. qt之解决qtableview加载百万行数据卡顿问题
  3. android rom制作教程,【图片】ROM助手:任意安卓机型的ROM制作教程【a298t吧】_百度贴吧...
  4. 数据库系统概论学习总结
  5. 【专题】CSDN下载频道5月热门资源top100汇总
  6. flowable 配置自定义表单_web工作流管理系统开发之四 自定义表单
  7. WebShell -- 开启3389服务
  8. Windows程序设计--起步
  9. ubuntu系统设置右键新建文本文档
  10. php中简单ubb案例,PHP中开发自己的UBB代码