Skip to content

Commit

Permalink
Merge pull request algorithm004-05#1093 from quzhen12/master
Browse files Browse the repository at this point in the history
600-Week 07
  • Loading branch information
melody-li authored Dec 4, 2019
2 parents 42f04cc + 173fef8 commit c7f52ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Week 7/id_600/LeetCode_191_600.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
func hammingWeight(num uint32) int {
times := 0
for ; num != 0; times++ {
num &= num - 1
}
return times
}
6 changes: 6 additions & 0 deletions Week 7/id_600/LeetCode_231_600.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
func isPowerOfTwo(n int) bool {
if n <= 0 {
return false
}
return n&(n-1) == 0
}

0 comments on commit c7f52ca

Please sign in to comment.