Guavus interview question

DSA : dp , linked list , tree