What exactly is input here?


#1

In this function -> numSetBits(unsigned int A)

here what exactly is A, like in the above example is A =11(decimal) or A = 00000000000000000000000000001011(binary)?

If it is the first case then before solving shouldn’t we change it to binary i.e. form 2?
Or the conversion is not required when doing bit manipulation?


#2

Hey, the input will be just a number in range 0 to 2(^32) -1. It will not be in binary represenation. Just a quick tip, generally when the question will want to give binary representation, it will be in form of string or array containing 0s or 1s. This is becoz, a number like 1000000000000000010011 cannot fit in any data type. So giving in form of string or array will be easy. Here the input is " int ".


#3

Got it! Thanks…