Amazon interview question

leet code medium/ hard array