Microsoft Interview Question: You are given a string and a ... |

Interview Question

Explore Interview Redmond, WA (US)

You 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

Interview Answer

1 Answer


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.

Interview Candidate on 1 Dec 2014

Add Answers or Comments

To comment on this, Sign In or Sign Up.