Skip to content

Commit 3a25114

Browse files
committed
Create 0476 - cpp
1 parent 0778cc9 commit 3a25114

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution {
2+
public:
3+
int findComplement(int num) {
4+
5+
int full = pow(2, int(log2(num)) + 1) - 1;
6+
7+
return ( full ^ num );
8+
}
9+
};

0 commit comments

Comments
 (0)