Amazon interview question

dp and graph and tree and string