Longest Word in Dictionary through Deleting
Given a string and a string dictionary, find the longest string in the dictionary that can be formed by deleting some characters of the given string. If there are more than one possible results, return the longest word with the smallest lexicographical order. If there is no possible result, return the empty string.
Example 1:
Example 2:
分析
就是loo字典里每个word,然后每个word和s比较,2个指针一个在word 一个在s 同时出发
这里不用map 因为会乱序,本体要求Order
Last updated