Scale Interview Question

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