Skip to content

Commit 6727f8f

Browse files
committed
pow of two
1 parent 8211538 commit 6727f8f

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

power-of-two/README.md

Whitespace-only changes.

power-of-two/Solution.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public class Solution {
2+
public boolean isPowerOfTwo(int n) {
3+
if(n == 0) return false;
4+
if(n == 1) return true;
5+
6+
if(n % 2 == 1) return false;
7+
8+
return isPowerOfTwo(n / 2);
9+
}
10+
}

power-of-two/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
layout: solution
3+
title: Power of Two
4+
date: 2015-07-06 23:00:26+08:00
5+
leetcode_id: 231
6+
---
7+
{% include_relative README.md %}

0 commit comments

Comments
 (0)