p326 发表于 2016-08-19 | 分类于 blog | LeetCode p326 Power of Three 题解1.题目: Given an integer, write a function to determine if it is a power of three. 题意: 输入一个int型数判断他是否是3的n次方 2.解题思路: 1162261467 = 3^19, 3^20 比 int 大 3.代码 [title] [] [url] [link text]1234567 public class Solution { public boolean isPowerOfThree(int n) { return ( n>0 && 1162261467%n==0); }} 4.一些总结: