326. Power of Three
来源:互联网 发布:淘宝助理批量删除描述 编辑:程序博客网 时间:2024/06/04 19:10
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?
public class Solution { public boolean isPowerOfThree(int n) { double temp = 10e-15; if(n==0) return false; double res = Math.log(n) / Math.log(3); return Math.abs(res-Math.round(res)) < temp; } }
阅读全文
0 0
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- 326. Power of Three
- python列表(List)的基本用法
- 第七章 SpringMVC+Mybatis-跟赵大笨笨学SpringMVC
- 页面优化
- Nginx 反向代理 Tomcat 返回403错误
- 时空分析
- 326. Power of Three
- Unity3D之仪表盘仪表
- KMP算法解析与实现
- 学习web mvc框架的步骤
- 学习方法:搜索相关
- 7. vue.js-饿了吗全套-webpack打包
- 7款bootstrap在线富文本编辑器
- 用python写一个简单的用户登陆程序(要求写成函数)
- twemproxy安装与简单应用