← 返回 meta 的题目列表Shortest Substring with N Unique Letters
类型:online_judge
Given a string s and an integer n, find the shortest substring that contains exactly n unique letters.\n\n### Input\n- A string s with a length between 1 and 10^5.\n- An integer n, which ranges from 1 to 26.\n\n### Output\n- The length of the shortest substring. If no such substring exists, return 0.\n\n### Examples\n\n#### Example 1:\nInput: "abcabc", 2\nOutput: 2\n\n#### Example 2:\nInput: "aaaa", 2\nOutput: 0
Example
Input
abcabc
2