I recently saw an interview question asking the following:
Given a 32 bit number, write pseudo code to flip the second last bit
What is the best/easiest way to do this?
#define MASK 0x00000002
new = old ^ MASK
I see some answers interpret "last bit" as MSB, others as LSB. Perhaps they're looking for candidates smart enough to pause and ask for clarification before cranking out code. That's very important in real-world work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With