Given an array of paired integers, write an algorithm to find the integer that is not paired, using constant space.
Anonymous
XOR them all together. I can't believe this counts as an interview question. In Haskell it is literally one line: findUnpaired = foldr1 Data.Bits.xor This works since: xor is associative and commutative, xor has identity 0, xor of two equal numbers gives 0.
Check out your Company Bowl for anonymous work chats.
Copyright © 2008-2026. Indeed, Inc. "Glassdoor," "Worklife Pro," "Bowls," and logo are proprietary trademarks of Indeed, Inc.