Pergunta de entrevista da empresa IBM

Dynamic programming question, file handling.