发布时间:2015-04-01 15:58:33
//3Sum Closest Total Accepted: 33841 Total Submissions: 125526 My Submissions Question Solution //Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exa.........【阅读全文】
发布时间:2015-04-01 10:33:26
/Given an integer, convert it to a roman numeral.////Input is guaranteed to be within the range from 1 to 3999.import java.util.HashMap;import java.util.Map;public class IntegertoRoman {public static void main(String[] args) {// TODO 自动生成的方法存根System.out.print(intToRoman(365));}.........【阅读全文】
发布时间:2015-03-31 16:52:28
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 code that.........【阅读全文】
发布时间:2015-03-31 13:06:39
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.注意:写的过程中问题不少 :穷举是跑不过的。要使用dp ,另外在循环中调用函数效率太低,我们要先把参数保留,.........【阅读全文】
发布时间:2015-03-29 12:04:55
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)).1.注意:M+N是偶数时要求平均值。2.并且用起始位置和个数来表示数组。3.求第K个值,我们不断在两个数组平分k来进行计算,去掉小的那个数组。4.........【阅读全文】