Genpact interview question

Example of code in Matlab