BaxEnergy Interview Question

A very simple algorithm question.