← 返回 microsoft 的题目列表Longest Substring Without Repeating Characters (write full main, include follow-ups)
类型:online_judge
Problem: Longest Substring Without Repeating Characters (must provide runnable main, include follow-ups)
Given a string s, return the length of the longest contiguous substring that contains no repeated characters.
Input (stdin)
One line: string s (visible ASCII characters; no spaces)
Output (stdout)
One integer: the maximum length
Constraints
0 <= len(s) <= 2 * 10^5
Follow-ups
Output the substring itself (any one if multiple).
If the input is a character stream, explain how to maintain the answer online and analyze memory usage.
Example
Input
abcabcbb
Output
3