Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: “babad” Output: “bab” Note: “aba” is also a valid answer. Example 2: Input: “cbbd” Output: “bb” Solution 1: class Solution { public String longestPalindrome(String s) { if(s==null || s.length()<=1) return s; boolean dp[][] =…… Continue reading Leetcode 5 Longest Palindromic Substring Java Solution