Terra Networks Interview Question

How would you speed up a certain example function.