2 parents 48b7b66 + 0c1cdd1 commit 47f575eCopy full SHA for 47f575e
1 file changed
21 May Check if All Bits Set
@@ -0,0 +1,9 @@
1
+class Solution {
2
+ public:
3
+ bool isBitSet(int n) {
4
+ // code here
5
+ int x=__builtin_popcount(n); //setbit
6
+ int y=log2(n)+1; //size
7
+ return x==y;
8
+ }
9
+};
0 commit comments