标签:cti == ret amp tco ati 位运算 log power
Given an integer, write a function to determine if it is a power of two.
public class Solution { public boolean isPowerOfTwo(int n) { return ((n&(n-1))==0&&n>0); } }
强大的位运算!!!
leetcode_231 Power Of Two(Bit Manipulation)
标签:cti == ret amp tco ati 位运算 log power
原文地址:http://www.cnblogs.com/ytq1016/p/6754762.html