Leetcode 326 Power of Three
2016-05-19 16:28
363 查看
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?
1162261467 = 3^19为int范围内最大, 如果一个数为3的n方,则该数需要能被这个最大的数整除。
Follow up:
Could you do it without using any loop / recursion?
1162261467 = 3^19为int范围内最大, 如果一个数为3的n方,则该数需要能被这个最大的数整除。
class Solution(object): def isPowerOfThree(self, n): return n>0 and 1162261467%n==0
相关文章推荐
- U盘中毒文件都不见了
- linux查看磁盘是否SSD盘
- 利用log4j显示hibernate打印sql中的参数
- G-CNN: an Iterative Grid Based Object Detector
- UICollectionView使用方法
- Android 添加系统服务
- linux内核启动第一阶段分析
- view发光阴影效果
- Javascript 严格模式“use strict” 详解
- tupian
- Subsets II
- 自定义异常简单实例
- es部署在docker里面,让es固定在一台slave上跑
- linux 权限
- Unity对象的所有组件深拷贝与粘贴
- 团队作业2
- 独立博客收藏
- Unity对象的所有组件深拷贝与粘贴
- 分布式存储 CentOS6.5虚拟机环境搭建FastDFS-5.0.5集群
- 使用内部类