Amazon interview question

dp tree graph traversal and so