Amazon Interview Question

dynamic programming, system design