TuSimple interview question

DP problem and a array problem