Skip to content

Commit 58754e7

Browse files
committed
docs: add problem description for 76
1 parent a3a80fb commit 58754e7

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/hard/readme.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,54 @@ Put the code below in main.rs and run `cargo run`
3131
println!("result: {:?}", result);
3232
```
3333

34+
# 76. Minimum Window Substring
35+
36+
## Description
37+
38+
Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring, return the empty string "".
39+
40+
The testcases will be generated such that the answer is unique.
41+
42+
A substring is a contiguous sequence of characters within the string.
43+
44+
## Examples
45+
46+
Example 1:
47+
48+
```
49+
Input: s = "ADOBECODEBANC", t = "ABC"
50+
Output: "BANC"
51+
Explanation: The minimum window substring "BANC" includes 'A', 'B', and 'C' from string t.
52+
```
53+
54+
Example 2:
55+
56+
```
57+
Input: s = "a", t = "a"
58+
Output: "a"
59+
Explanation: The entire string s is the minimum window.
60+
```
61+
62+
Example 3:
63+
64+
```
65+
Input: s = "a", t = "aa"
66+
Output: ""
67+
Explanation: Both 'a's from t must be included in the window.
68+
Since the largest window of s only has one 'a', return empty string.
69+
```
70+
71+
## How to Run in main.rs
72+
73+
Put the code below in main.rs and run `cargo run`
74+
75+
```rust
76+
let s = String::from("ADOBECODEBANC");
77+
let t = String::from("ABC");
78+
let result = hard::minimum_window_substring::min_window(s, t);
79+
println!("result: {:?}", result);
80+
```
81+
3482
# 84. Largest Rectangle in Histogram
3583

3684
## Description

0 commit comments

Comments
 (0)