IBM interview question

Dynamic programming question, file handling.