Refactor solution to "two sum".