JPMorganChase interview question

some medium dynamic programming problems.