IBM Interview Question: The question was "How do you ... | Glassdoor

Interview Question

Software Engineer Interview Lenexa, KS

The question was "How do you swap two values without

  creating a new variable?"
Tags:
technical, brain teaser, programming, logc
Answer

Interview Answer

1 Answer

4

I didn't answer the question correctly, but I looked it up later and found it:
a = a XOR b
b = a XOR b
a = a XOR b

Interview Candidate on Mar 8, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.