JPMorganChase Interview Question

some medium dynamic programming problems.