Outgive interview question

typical lc hard dynamic programming problem