Skip to content

Latest commit

 

History

History
35 lines (15 loc) · 514 Bytes

LeetCode1147. 段式回文-20230412.md

File metadata and controls

35 lines (15 loc) · 514 Bytes

LeetCode刷题1147.段式回文

image-20230412101248942

算法思想

方法一:贪心+双指针

复杂度分析

时间复杂度: $O(n^2)$ , 其中 n 为字符串的长度。

空间复杂度: $O(1)$

方法二:滚动哈希(Rabin-Karp)

复杂度分析

时间复杂度: $O(n)$ , 其中 n 为字符串的长度。

空间复杂度: $O(1)$