We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b66f463 commit ff278e4Copy full SHA for ff278e4
CPP/PowerOfFour.cpp
@@ -0,0 +1,30 @@
1
+class Solution {
2
+public:
3
+ double value4(double d)
4
+{
5
+ return (log2(d))/2;
6
+}
7
+bool is_integer(float k)
8
9
+ return std::floor(k) == k;
10
11
+ bool isPowerOfFour(int n) {
12
+ if(n<=0){
13
+ return false;
14
+ }
15
+ if(n==1){
16
+ return true;
17
18
+ if(n%4!=0){
19
20
21
+ else{
22
+ if(is_integer(value4(n))){
23
24
25
26
27
28
29
30
+};
0 commit comments