Addverb Technologies interview question

Regular Expression Matching LC 5