209. Minimum Size Subarray Sum
Can use 2 pointers with O(n)
complexity. Notice that when end read the end of array should continue to move the start pointer.
392. Is subsequence
- Use DP. very simple 1D DP.Notice that should check whether pattern string has already reached the end.
- Use preprocessing & binary search for a lot of pattern string. eg: record all positions of matched string, then use position keep tracking its first appearing position.
- Can use a Trie to record the current all pattern string. Now comes another string, find longest prefix in the trie and starts from here to match with the base string.