kevin
BAN USER- 7of 7 votes
AnswersGiven a regular expression with characters a-z, ' * ', ' . '
- kevin in United States
the task was to find if that string could match another string with characters from: a-z
where ' * ' can delete the character before it, and ' . ' could match whatever character. ' * ' always appear after a a-z character.
Example:
isMatch("a*", "") = true;
isMatch(".", "") = false;
isMatch("ab*", "a") = true;
isMatch("a.", "ab") = true;
isMatch("a", "a") = true;| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern Algorithm
I'm not sure if your algorithm works correctly, in the comparison between s2[j] and s1[i], why don't you increase i?. And why do you always skip the character before *?, some other examples:
isMatch("a*abc", "abc") = true;
isMatch("a*a*a*", "a") = true;
isMatch("a*bd*c","abc") = true;
Repjenniferdray9, Accountant at ABC TECH SUPPORT
Hi I am Jennifer D. Ray from san Diego.Currently i am working as a parts salesperson in Rite solution ...
Repmarkemorgan007, Applications Developer at Big Fish
I am Mark From Fresno city in USA.I working as a tour guide and also help for make a ...
I think that your algorithm for this case: isMatch("a*abc", "abc") = true; will return false. Let me know if I'm wrong.
- kevin October 14, 2013