Rupeek interview question

Basic data structures and DP based question.