Salesforce interview question

Question was about dynamic programming...