菜鸡的学历路程hh
记录一下最近刷的算法题
输入一个字符串s,请返回该字符串的“只包含一种字符的最长非空子字符串”。
输入:“ssssssssssssssshhhhopeeeeeeee”
输出:“sssssssssssssss”
代码:
class Solution:
def findLongestSubstr(self , str ):
list = ''
count = 1
max = 0
index = 0
for i in range(len(str)-1):
if str[i] == str[i+1]:
count += 1
if i == len(str)-2 and max
测试通过用例:7/10
大小写判断没做出来。。
(大小写不同)



