IBM interview question

DP, Linked list questions from leetcode