3064. Guess the Number Using Bitwise Questions I
There is a number
nthat you have to find.There is also a pre-defined API
int commonSetBits(int num), which returns the number of bits where bothnandnumare1in that position of their binary representation. In other words, it returns the number of set bits inn & num, where&is the bitwiseANDoperator.Return the number
n.
1 | /** |