Amazon Interview Question

Dynamic Programming, Trees and graphs