发布时间:2015-01-19 11:26:49
题目:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I I GY I RAnd then read line by line: "PAHNAPLSIIGYIR"Write the co.........【阅读全文】
发布时间:2015-01-17 22:50:26
题目: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.最直观的解法,找出该字符串所有子字符串,依次判断该子字符串是否为回文字符串,之后再找出最长的子回文.........【阅读全文】
发布时间:2015-01-17 11:38:15
题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)Output: 7 -> 0 -> 8解法:.........【阅读全文】
发布时间:2015-01-17 11:16:55
题目: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.解决方案:点击(此处)折叠.........【阅读全文】
发布时间:2015-01-14 17:44:08
题目:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).我的思路很简单,将两个数组合并为一个有序数组,程序如下:点击(此处)折叠或打开public class Solution {.........【阅读全文】