Pregunta de entrevista de Tata Consultancy Services

Question on string and DP.