Solution for the two sum problem