码迷,mamicode.com
首页 > Windows程序 > 详细

[LeetCode] Minimum Window Subsequence 最小窗口序列

时间:2018-04-01 01:03:43      阅读:382      评论:0      收藏:0      [点我收藏+]

标签:char   contain   bsp   pre   example   lower   multi   occurs   rac   

 

Given strings S and T, find the minimum (contiguous) substring W of S, so that T is a subsequence of W.

If there is no such window in S that covers all characters in T, return the empty string "". If there are multiple such minimum-length windows, return the one with the left-most starting index.

Example 1:

Input: 
S = "abcdebdde", T = "bde"
Output: "bcde"
Explanation: 
"bcde" is the answer because it occurs before "bdde" which has the same length.
"deb" is not a smaller window because the elements of T in the window must occur in order.

 

Note:

  • All the strings in the input will only contain lowercase letters.
  • The length of S will be in the range [1, 20000].
  • The length of T will be in the range [1, 100].

 

s

 

[LeetCode] Minimum Window Subsequence 最小窗口序列

标签:char   contain   bsp   pre   example   lower   multi   occurs   rac   

原文地址:https://www.cnblogs.com/grandyang/p/8684817.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!