Salesforce interview question

Standard stack problem.