Goldman Sachs interview question

Some question regarding list reordering