Some IDEs let you type a non-contiguous substring of the file name in order to search and open a file. Write a method that takes a pattern and a filename and returns whether or not the pattern is a non-contiguous substring of the filename. For instance, pattern “Mav” is a non-contiguous substring of “MyJavaClass.java”. “MM” is not.
Usually the IDE will let you type and when you pause, it will display the current list of matches. Pretend you’re working on a team for this feature. Someone else is in charge of UI and collecting the current pattern whenever the user pauses. Write a utility that will take the pattern and return a list of the current matches. For example, if the user input is: Mava 1st call: “Ma” 2nd call: “Mav” 3rd call: “Mava”
Given string S and a dictionary of words words , find the number of words[i] that is a subsequence of S .
Example :
Input:
S = "abcde"
words = ["a", "bb", "acd", "ace"]
Output: 3
Explanation: There are three words in words that are a subsequence of S: "a", "acd", "ace".
这里的 Map 我再进一步解释一下
key 是 Character, value 的 class 如下
class Bucket {
List<Integer> indexes; // index in original wildcard array
String s; // substring split by *
List<Integer> begIndex; // begin index of word for corresponding wild card
}
Design a class WordFilter that supports one function, WordFilter.f(String prefix, String suffix) . It will return the word with given prefix and suffix with maximum weight. If no word exists, return -1.