Pergunta de entrevista da empresa UBS

Then again a DSA question on 2d array/vectors