[LeetCode]005.Longest Palindromic Substring

Question

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.

Solution

  • C
1
2
3
char* longestPalindrome(char* s) {
}
  • C++
1
2
3
4
5
6
class Solution {
public:
string longestPalindrome(string s) {
}
};
  • Java
1
2
3
4
5
public class Solution {
public String longestPalindrome(String s) {
}
}
  • JavaScript
1
2
3
4
5
6
7
/**
* @param {string} s
* @return {string}
*/
var longestPalindrome = function(s) {
};
  • Python
1
2
3
4
class Solution:
# @param {string} s
# @return {string}
def longestPalindrome(self, s):
  • Swift
1
Hello World
坚持原创技术分享,您的支持将鼓励我继续创作!