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).
For example, S = ”ADOBECODEBANC”, T = ”ABC”
Minimum window is ”BANC”.
Note:
• If there is no such window in S that covers all characters in T , return the emtpy string ””.
• If there are multiple such windows, you are guaranteed that there will always be only one unique
minimum window in S.
Minimum Window Substring
寻找字符串中最短包含所有字符的子串
最新推荐文章于 2025-04-23 16:11:55 发布
本文提供了一种复杂度为O(n)的方法,用于在给定字符串中找到包含另一个字符串所有字符的最短子串。例如,给定S=“ADOBECODEBANC”,T=“ABC”,最小窗口是“BANC”。如果不存在这样的窗口,则返回空字符串。
378

被折叠的 条评论
为什么被折叠?



