Hola Interview Question

Optimise a function