|
| 1 | +{ |
| 2 | + "problem_name": "minimum_window_substring", |
| 3 | + "solution_class_name": "Solution", |
| 4 | + "problem_number": "76", |
| 5 | + "problem_title": "Minimum Window Substring", |
| 6 | + "difficulty": "Hard", |
| 7 | + "topics": "Hash Table, String, Sliding Window", |
| 8 | + "tags": ["grind-75", "neetcode-150"], |
| 9 | + "readme_description": "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 `\"\"`.\n\nThe testcases will be generated such that the answer is unique.", |
| 10 | + "readme_examples": [ |
| 11 | + { |
| 12 | + "content": "```\nInput: s = \"ADOBECODEBANC\", t = \"ABC\"\nOutput: \"BANC\"\n```\n**Explanation:** The minimum window substring \"BANC\" includes 'A', 'B', and 'C' from string t." |
| 13 | + }, |
| 14 | + { |
| 15 | + "content": "```\nInput: s = \"a\", t = \"a\"\nOutput: \"a\"\n```\n**Explanation:** The entire string s is the minimum window." |
| 16 | + }, |
| 17 | + { |
| 18 | + "content": "```\nInput: s = \"a\", t = \"aa\"\nOutput: \"\"\n```\n**Explanation:** Both 'a's from t must be included in the window. Since the largest window of s only has one 'a', return empty string." |
| 19 | + } |
| 20 | + ], |
| 21 | + "readme_constraints": "- `m == s.length`\n- `n == t.length`\n- `1 <= m, n <= 10^5`\n- `s` and `t` consist of uppercase and lowercase English letters.", |
| 22 | + "readme_additional": "**Follow up:** Could you find an algorithm that runs in `O(m + n)` time?", |
| 23 | + "solution_imports": "", |
| 24 | + "solution_methods": [ |
| 25 | + { |
| 26 | + "name": "min_window", |
| 27 | + "parameters": "s: str, t: str", |
| 28 | + "return_type": "str", |
| 29 | + "dummy_return": "\"\"" |
| 30 | + } |
| 31 | + ], |
| 32 | + "test_imports": "import pytest\nfrom leetcode_py.test_utils import logged_test\nfrom .solution import Solution", |
| 33 | + "test_class_name": "MinimumWindowSubstring", |
| 34 | + "test_helper_methods": [ |
| 35 | + { "name": "setup_method", "parameters": "", "body": "self.solution = Solution()" } |
| 36 | + ], |
| 37 | + "test_methods": [ |
| 38 | + { |
| 39 | + "name": "test_min_window", |
| 40 | + "parametrize": "s, t, expected", |
| 41 | + "parametrize_typed": "s: str, t: str, expected: str", |
| 42 | + "test_cases": "[(\"ADOBECODEBANC\", \"ABC\", \"BANC\"), (\"a\", \"a\", \"a\"), (\"a\", \"aa\", \"\")]", |
| 43 | + "body": "result = self.solution.min_window(s, t)\nassert result == expected" |
| 44 | + } |
| 45 | + ], |
| 46 | + "playground_imports": "from solution import Solution", |
| 47 | + "playground_test_case": "# Example test case\ns = \\\"ADOBECODEBANC\\\"\nt = \\\"ABC\\\"\nexpected = \\\"BANC\\\"", |
| 48 | + "playground_execution": "result = Solution().min_window(s, t)\nresult", |
| 49 | + "playground_assertion": "assert result == expected" |
| 50 | +} |
0 commit comments