美文网首页
Day51:连续最长子串,与Day50一类问题(未完成)

Day51:连续最长子串,与Day50一类问题(未完成)

作者: 快乐的老周 | 来源:发表于2020-07-25 22:49 被阅读0次

给你一个字符串 s ,请你返回满足以下条件的最长子字符串的长度:每个元音字母,即 'a','e','i','o','u' ,在子字符串中都恰好出现了偶数次。

示例 1:

输入:s = "eleetminicoworoep"

输出:13

解释:最长子字符串是 "leetminicowor" ,它包含 e,i,o 各 2 个,以及 0 个 a,u 。

示例 2:

输入:s = "leetcodeisgreat"

输出:5

解释:最长子字符串是 "leetc" ,其中包含 2 个 e 。

示例 3:

输入:s = "bcbcbc"

输出:6

解释:这个示例中,字符串 "bcbcbc" 本身就是最长的,因为所有的元音 a,e,i,o,u 都出现了 0 次。

提示:

1 <= s.length <= 5 x 10^5

s 只包含小写英文字母。

补充代码

class Solution(object):

# def findTheLongestSubstring(self, s):
    # """
    # :type s: str
    # :rtype: int
    # """

来源:力扣(LeetCode)

链接:力扣 https://leetcode-cn.com/problems/find-the-longest-substring-containing-vowels-in-even-counts

class Solution(object):
def findTheLongestSubstring(self, s):

def test_solution():
solution = Solution()
s = "eleetminicoworoep"
solution.findTheLongestSubstring(s) == 13
s = "leetcodeisgreat"
solution.findTheLongestSubstring(s) == 5
s = "bcbcbc"
solution.findTheLongestSubstring(s) == 6

相关文章

网友评论

      本文标题:Day51:连续最长子串,与Day50一类问题(未完成)

      本文链接:https://www.haomeiwen.com/subject/varvlktx.html