Pregunta de entrevista de Rupeek

Basic data structures and DP based question.