Amazon Interview Question

2 difficult recursive/dynamic programming type questions on hackerrank