Goldman Sachs Interview Question

Dynamic Programming.