# 1 题目描述

Given an integer, write a function to determine if it is a power of two.

# 4 源代码

package com.larry.easy;

import java.util.HashSet;

public class PowerOfTwo {
public boolean isPowerOfTwo(int n) {
//打表
HashSet<Integer> hs = new HashSet<Integer>();

boolean ret = hs.contains(n);
return ret;
}
public static void main(String[] args) {
/*System.out.println(Integer.MAX_VALUE);
for(int i = 0; i < 36; i++)
System.out.println("hs.add(" + (int)(Math.pow(2, i)) + ");");*/
}
}


#### 231. Power of Two [easy] (Python)

2016-05-05 14:47:26

#### 随机的力量(1) - The power of random two choices

2015-11-01 00:43:52

#### leetcode 231: Power of Two

2015-07-07 05:01:24

#### LeetCode 231: Power of Two

2015-07-06 18:34:20

#### leetcode 231. Power of Two 判断是否为2的幂 Java

2016-04-23 16:38:25

#### [LeetCode] Power of Three | Power of Two

2016-01-28 21:39:28

#### Round Up To Power Of Two

2015-08-30 21:33:43

#### Java容器与Hash算法的研究

2016-04-29 11:29:23

#### Power Analysis

2014-03-05 16:36:43

#### Non Power of Two Textures 无二次幂限制的纹理

2015-09-04 14:40:41