Roke Manor Research interview question

How would you optimise your code/algorithm?