难度: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. mysql 是dos程序_mysql Dos操作
  2. 学习.NET的两个网站:MSDN和Asp .NET
  3. diamond源码阅读-diamond-client
  4. 快速乘法(防止数过大相乘超出long long)
  5. 【Python】Python办公自动化 | 一键给PDF文件加密,超方便
  6. vue --- v-html、v-bind
  7. 小汤学编程之JAVA基础day09——常用类(一):比较器、内部类和包装类
  8. 团队计划(4.22)
  9. CentOS7.2 在线安装MySQL8.0
  10. html语言标记说明,HTML中注释标签的使用方法
  11. 2017中国之旅系列之十:山西张壁古堡之旅
  12. 利用MATLAB计算输出响应,[笔记]离散系统的频率响应和输出响应的matlab实现.doc
  13. 江阴学计算机,江阴学习计算机平面设计
  14. 计算机高级工程师职称评定条件,高级工程师职称评定条件是什么
  15. 简单密码验证:重复的数字字母或连续的数字字母
  16. Exp1 PC平台逆向破解 20164302 王一帆
  17. matlab改变图像像素吗,在图像中随机更改像素值程序——matlab
  18. 直播开发软件平台搭建需要重点解决这一技术
  19. 1089 质因数分解
  20. 能不能接受五一放一天不调休?专家建议固定法定假期取消调休

热门文章

  1. uibot中级认证试题_喜大普奔丨UiBot中级认证工程师考试上线啦!
  2. vs2017结合qt开发,vs报错找不到库(解决方案)
  3. 攻防世界 用什么工具_橱柜清洁、控油方法 厨房清洁工具用什么好
  4. dll导出类比较好的方式
  5. C++中对私有成员变量进行赋值
  6. SAP GUI 760 下载
  7. 线性代数及matlab实现,线性代数及其MATLAB应用
  8. MVC 《web考勤管理系统》 项目研发文献
  9. 车牌识别opencv_基于OpenCV 的车牌识别
  10. iphone 装 android系统,如何在iPhone上安装Android系统