Leetcode.76 Minimum Window Substring (Java)
2021-04-02 16:26
标签:etc The lex while unique nta imu nim complex Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). Example: Note: Leetcode.76 Minimum Window Substring (Java) 标签:etc The lex while unique nta imu nim complex 原文地址:https://www.cnblogs.com/xm08030623/p/13475945.htmlLeetcode.76 Minimum Window Substring
Input: S = "ADOBECODEBANC", T = "ABC"
Output: "BANC"
""
.Solution
class Solution {
public String minWindow(String s, String t) {
int sl = s.length();
int tl = t.length();
if(sl == 0 || tl == 0 || sl = 0){
co ++;
}
// 当找到substring需要夹逼找到最短的字串
if(co == tl){
while(freq[s.charAt(l)]
文章标题:Leetcode.76 Minimum Window Substring (Java)
文章链接:http://soscw.com/essay/71447.html