leetcode/include/s0005_longest_palindromic_s...

41 lines
1.1 KiB
C++

#ifndef S0005_LONGEST_PALINDROMIC_SUBSTRING_HPP
#define S0005_LONGEST_PALINDROMIC_SUBSTRING_HPP
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef struct S0005ResultStruct {
int left1; // 边界情况为长度为 1 的字符时,扩展完成后的左边界
int right1; // 边界情况为长度为 1 的字符时,扩展完成后的右边界
int left2; // 边界情况为长度为 2 的字符串时,扩展完成后的左边界
int right2; // 边界情况为长度为 2 的字符串时,扩展完成后的右边界
} S0005Result;
class S0005 {
public:
/**
* @brief Longest Palindromic Substring
*
* Given a string s, return the longest palindromic substring in s.
*
* @param s the given string
* @return longest palindromic substring
*/
string longestPalindrome1(string s);
/**
* @brief Longest Palindromic Substring
*
* Given a string s, return the longest palindromic substring in s.
*
* @param s the given string
* @return longest palindromic substring
*/
string longestPalindrome2(string s);
S0005Result expand(string s, int i);
};
#endif