Hola Interview Question

Rewrite a given function to make it as short as possible and optimize it if possible.