UC San Diego Interview Question

How do you write a certain function in matlab