doocs/leetcode

LeetCode 第5题 Python3 版的解法超时

ChuckieChen945 opened this issue · 4 comments

LeetCode 第5题 5. 最长回文子串 Python3 版的解法原样提交后提示 Time Limit Exceeded

没超时呢,我试了。数据规模 $10^3$,算法时间复杂度 $O(n^2)$,可以通过

image

英文站点应该是新增了测试用例了,导致代码无法通过

没错,英文站点超时了

新增了空间复杂度 $O(1)$ 的解法,这个解法不会超时了。