【Microsoft面经】OA 2019 | Longest Substring Without 3 Contiguous Occurrences of Letter Microsoft OA 开发岗

飞天猪 2020-5-15 848


Given a string s containing only a and b, find longest substring of s such that s does not contain more than two contiguous occurrences of a and b.

Example 1:

Input: "aabbaaaaabb"

Output: "aabbaa"

Example 2:

Input: "aabbaabbaabbaa"

Output: "aabbaabbaabbaa"

最后于 2020-6-1 被maomoke编辑 ,原因:
最新回复 (0)
返回