TwoSum algorithms