File tree 1 file changed +3
-22
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +3
-22
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import java .util .Arrays ;
4
4
5
- /**
6
- * 727. Minimum Window Subsequence
7
- *
8
- * Given strings S and T, find the minimum (contiguous) substring W of S, so that T is a subsequence of W.
9
- * If there is no such window in S that covers all characters in T,
10
- * return the empty string "". If there are multiple such minimum-length windows, return the one with the left-most starting index.
11
-
12
- Example 1:
13
- Input:
14
- S = "abcdebdde", T = "bde"
15
- Output: "bcde"
16
-
17
- Explanation:
18
- "bcde" is the answer because it occurs before "bdde" which has the same length.
19
- "deb" is not a smaller window because the elements of T in the window must occur in order.
20
-
21
- Note:
22
- All the strings in the input will only contain lowercase letters.
23
- The length of S will be in the range [1, 20000].
24
- The length of T will be in the range [1, 100].
25
- */
26
5
public class _727 {
27
6
public static class Solution1 {
28
7
/**
@@ -53,7 +32,9 @@ private boolean isSubsequence(String T, String sub) {
53
32
}
54
33
55
34
public static class Solution2 {
56
- /**credit: https://github.com/lydxlx1/LeetCode/blob/master/src/_727.java*/
35
+ /**
36
+ * credit: https://github.com/lydxlx1/LeetCode/blob/master/src/_727.java
37
+ */
57
38
public String minWindow (String S , String T ) {
58
39
int [][] dp = new int [S .length () + 1 ][T .length () + 1 ];
59
40
int INFINITY = 1 << 29 ;
You can’t perform that action at this time.
0 commit comments