why it is doing that?
Returning -1 in update bit function
//Clear Bit
int clearBit(int n,int i){
int mask= ~(1<<i);
int ans = n | mask;
return ans;
}
bold one is wrong
correct one is
int ans = n & mask;
why it is doing that?
//Clear Bit
int clearBit(int n,int i){
int mask= ~(1<<i);
int ans = n | mask;
return ans;
}
bold one is wrong
correct one is
int ans = n & mask;