Amazon interview question

two sum, and three sum