Surescripts interview question

Dynamic programming question, string array parse question