Goldman Sachs interview question

coding basic array data structure