Scale interview question

Dynamic programming question, regex question, and another one I forgot.