Terra Networks interview question

How would you speed up a certain example function.