Punt Partners interview question

Asked to explain DP leetcode problem.