Amazon Interview Question

leet code medium/ hard array