返回题库

回文子串

Palindromic Substrings

专题
Algorithmic Programming / 算法编程
难度
L3
来源
Citadel

题目详情

问题:回文子串

考察:双指针、字符串、动态规划

来源:DSA Prep / Citadel

链接:https://leetcode.com/problems/palindromic-substrings

Problem: Palindromic Substrings

Patterns: Two Pointers, String, Dynamic Programming

Recency: 6mo

Link: https://leetcode.com/problems/palindromic-substrings

Source: https://www.dsaprep.dev/blog/citadel-coding-interview-questions/

解析

思路:枚举每个回文中心,包括字符中心和字符间中心,向两边扩展,只要两端相等就计数。

复杂度:时间 O(n^2),空间 O(1)。