UC San Diego interview question

How do you write a certain function in matlab