Microsoft Interview Question

Dynamic Programming, trees, and DS