Goldman Sachs interview question

problem using array list of arrray list