Explore Interview Redmond, WA (US)
MicrosoftAnswerYou are given a string and a regex-esque pattern. In the
pattern, ? maps to exactly one character, and * maps to 0 to infinite characters that can be any character. The following strings would match the pattern ab*dc?: abdca, abdce, abbbbbdcz, abiokdcp
1 Answer
To comment on this, Sign In or Sign Up.
Would you like us to review something? Please describe the problem with this {0} and we will look into it.
Your feedback has been sent to the team and we'll look into it.
This was the hardest question of the three, and was also my PM interview. I compared the string and pattern character by character. If I reached a *, then I would recursively call my function on the substring that was after the * and see if that matched any of the substrings generated in the string.