UBS Interview Question

Then again a DSA question on 2d array/vectors