Amazon interview question

3D array manipulation and search