Thoughtworks interview question

Steps to optimize a code.