Bloomberg interview question

Matlab coding