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 8a164db commit 7a5e7a4Copy full SHA for 7a5e7a4
869. Reordered Power of 2
@@ -0,0 +1,15 @@
1
+class Solution {
2
+public:
3
+ bool reorderedPowerOf2(int n) {
4
+ string str = to_string(n);
5
+ sort(str.begin(),str.end());
6
+
7
+ for (int i=0;i<31;i++){
8
+ int x = pow(2,i);
9
+ string ss = to_string(x);
10
+ sort(ss.begin(),ss.end());
11
+ if(str==ss) return 1;
12
+ }
13
+ return 0;
14
15
+};
0 commit comments