Thoughtworks Interview Question

Steps to optimize a code.