But why?
Most code is about patterns, specific code styles and reusing existing libraries. Without context none of that can be applied to the solution.
If you put a programmer in a room and give them a piece of paper with a function and say OPTIMISE THAT! - is it going to be their best work?