Microsoft | Round 1 | Better url match

Anonymous User
128
May 19, 2023

Given a list of url regix that map to a particular url
eg:
/foo/bar/loo/moo/a/b/c/d
All these are valid regex check
answers= ["/foo*" , /foo/bar/*/moo/a/b/c/d , /foo/bar/loo/* /foo/bar/loo/moo/a/b/*/d]

Question
For a given url string (/foo/bar/loo/moo/a/b/c/d) and the answers list which is the best possible regex

Based on this condition

  1. The position of * in the url . eg :/foo/bar/loo/* > /foo/bar/*
  2. If condition 1. is same for any two urls , count of hoe many matching keys which are not *
    eg: /foo/bar/loo/*/a/* < `/foo/bar/loo/*/a/b/c

Now the list can be around size 100 .

Comments (0)