LeetCode: Minimum Window Substring
2020-12-13 01:52
标签:style class blog c code java LeetCode: Minimum Window Substring,搜素材,soscw.com LeetCode: Minimum Window Substring 标签:style class blog c code java 原文地址:http://www.cnblogs.com/Jellylovecode/p/MinimumWindowSubstring.html 1 /**
2 *
3 */
4 package solution;
5
6 import java.util.HashMap;
7
8 /**
9 * @author whh
10 *
11 * Given a string S and a string T, find the minimum window in S which
12 * will contain all the characters in T in complexity O(n).
13 *
14 * For example, S = "ADOBECODEBANC", T = "ABC" Minimum window is "BANC".
15 *
16 * Note:
17 *
18 * If there is no such window in S that covers all characters in T,
19 * return the emtpy string "". If there are multiple such windows, you
20 * are guaranteed that there will always be only one unique minimum
21 * window in S.
22 */
23 public class MinimumWindowSubstring {
24
25 /**
26 * @param args
27 */
28 public static void main(String[] args) {
29 MinimumWindowSubstring mws = new MinimumWindowSubstring();
30 String S = "aabbDEE", T = "aabbDEE";
31 System.out.println(mws.minWindow(S, T));
32 }
33
34 /**
35 * @param S
36 * @param T
37 * @return
38 */
39 public String minWindow(String S, String T) {
40
41 HashMap
文章标题:LeetCode: Minimum Window Substring
文章链接:http://soscw.com/essay/24365.html