摘要: Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest palindromic substring.O(n*n)。对于每一个字符,以之作为中间元素往左右寻找。注意处理奇偶两种模式:1. aba2. abba 1 public class Solution { 2 public String longestPalindrome(String s) { ... 阅读全文
posted @ 2013-06-17 10:54 feiling 阅读(273) 评论(0) 推荐(0) 编辑
摘要: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the length of 1.从 阅读全文
posted @ 2013-06-17 09:41 feiling 阅读(257) 评论(0) 推荐(0) 编辑