Motorola Mobility Interview Question: Switch the nth digit of a bin... | Glassdoor

Interview Question

Senior Software Engineer Interview San Diego, CA

Switch the nth digit of a binary number. Ex. for 1101 if

  you switch the 3rd digit it becomes 1011.
Answer

Interview Answer

1 Answer

1

XOR with 2^n, where n is the nth digit.

Interview Candidate on Jul 7, 2011

Add Answers or Comments

To comment on this, Sign In or Sign Up.