Блог пользователя acash

Автор acash, история, 3 месяца назад, По-английски

the developres at amazon are developing a regex matching libraary for their nlp use cases. a prototype regex matching has the following requirments:

the regex expression contains lowecase english letters, '(', ')' , '.' and '*'.

'.' matches with exactly one lower case english letter

a regular expression followed by '*' matches with zero or more occurences of the regular expression

if an expression is enclosed in parentheses '(' and ')' it is treated as one expression and any asterisk '*' applies to the whole expression

for example regex " (ab)*d "matches with string "d" , "ababd", "abd", but not with "abbd"

given an array arr of length kcontaining strings consisting of lower case english letters only and a string regex of length n , for each of them find whether the given regex matches the string or not and report an array of strings "YES" or "NO" RESPECTIVELY

This question is quite frequently appearing in recent amazon oa observed from leetcode discuss sections. There is similar question on leetcode wildcard matchig but in this we have quotes also () which makes it more tougher any help would be much appreciated on it Thanks.

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится