C3 AI interview question

2-D DP problem was asked.