Skip to content

Commit 9a0c9ca

Browse files
committed
Update power-of-four.cpp
1 parent 70d63ca commit 9a0c9ca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

C++/power-of-four.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// Time: O(logn)
2-
// Space: O(logn)
1+
// Time: O(1)
2+
// Space: O(1)
33

44
class Solution {
55
public:
66
bool isPowerOfFour(int num) {
77
return num > 0 && (num & (num - 1)) == 0 &&
8-
((num & 0b101010101010101010101010101010101) == num);
8+
((num & 0b01010101010101010101010101010101) == num);
99
}
1010
};
1111

0 commit comments

Comments
 (0)