leetcode——326——Power of Three
来源:互联网 发布:如何卸载mac上的app 编辑:程序博客网 时间:2024/06/15 05:28
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.
Subscribe to see which companies asked this question
class Solution {public: bool isPowerOfThree(int n) { double result = log10(n) / log10(3); return (result-int(result)==0)?true:false; }};
0 0
- LeetCode题解——Power of Three
- Leetcode——326. Power of Three
- leetcode——326——Power of Three
- leetcode-326-Power of Three
- [LeetCode 326] Power of Three
- LeetCode 326:Power of Three
- Leetcode 326:Power of Three
- leetcode-326-Power of Three
- LeetCode 326 Power of Three
- [LeetCode 326] Power of Three
- (LeetCode 326)Power of Three
- LeetCode-326 Power of Three
- LeetCode-326: Power of Three
- LeetCode 326 Power of Three
- Leetcode 326 : Power of Three
- Leetcode 326 Power of Three
- leetcode-326-Power of Three
- Leetcode 326 Power of Three
- 找工作——jvm复习(二)
- EvenBus3.0中文翻译(二)Priorities and Event Cancellation
- LeetCode 15 3Sum(尺取法或哈希)
- C++作业2
- YII通过db执行sql语句可以看下面
- leetcode——326——Power of Three
- 多窗口切换及警告框
- android SpannableStringBuilder
- 缓存淘汰算法--LRU算法
- linux下内存的统计和内存泄露类问题的定位
- 图解正向代理、反向代理、透明代理
- 友盟即时通讯-导入到你的项目中
- iOS开发关于三方框架的使用注意的地方,跟新到最新的SDK
- web PHP判断请求来自PC还是Mobile