Amazon interview question

Two sum lc question a