手写代码:求一个字符串最长回文子串 参考答案 参考回答: int LongestPalindromicSubstring(string & a) { int len = a.length(); vector<vector<int>>dp(len, vector<int>(len, 0)); for (int i = 0; i < len; i++) { dp[i][i] = 1; } int max_len = 1; int start_index = 0; ...
#include <stdlib.h> int ishuiwen(char *p) { int i = strlen(p); for(int j=0;j<=i/2;j++) { if(p[j] !=p[i-j-1]) { return 0; } } return 1; } char * getSubString(char *p, int m, int slen) { char *buf = new char[strlen(p) + 1]; int count = 0; for(int ...
const int num) { const char *strend = srcstart + (num - 1); //printf("%s\n", strend...