Uber interview question

Given a regular expression pattern and a string, check to see if pattern matches the string.

Interview Answers

Anonymous

8 Dec 2015

#1: generate a non-finite automaton (NFA) from the regular expression. #2: convert NFA to Deterministic finite automaton (DFA) #3: run string through DFA to see if there is a match

Anonymous

5 Aug 2014

Similar to checking if 2 strings are similar (maintain pointers in each string and forward if matches) but look for special chars (like *, & etc)