LinkedIn interview question

Valid Number and Dynamic Programming