问一道面试题。# JobHunting - 待字闺中
f*y
1 楼
Implement a code to do wildcast string matching.
e.g. source: readme.txt, query: *.txt, should return true.
试着写
bool ismatch(string& source, string& query){}
用两个indices i, j扫描。遇到*就继续i自增寻找匹配, string里面有duplicate的时
候比较复杂。不知有没有其他解法,用标准库的函数find也挺复杂。
求大牛指点!
e.g. source: readme.txt, query: *.txt, should return true.
试着写
bool ismatch(string& source, string& query){}
用两个indices i, j扫描。遇到*就继续i自增寻找匹配, string里面有duplicate的时
候比较复杂。不知有没有其他解法,用标准库的函数find也挺复杂。
求大牛指点!