Snap interview question

two sum and longest common prefix