最长回文子串

B站影视 2024-12-21 21:13 2

摘要:def longestPalindrome(s: str) -> str:if len(s) = 0 and right < len(

Python

def longestPalindrome(s: str) -> str:if len(s) = 0 and right

C++

#include #include using namespace std;class Solution {public:string expandAroundCenter(const string& s, int left, int right) {while (left >= 0 && right result.size) {result = odd_palindrome;}if (even_palindrome.size > result.size) {result = even_palindrome;}}return result;}};int main {Solution solution;string s;// 获取用户输入cout

来源:文化点缀生活

相关推荐