摘要: 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.... 阅读全文
posted @ 2015-04-29 20:14 TonyLuis 阅读(269) 评论(0) 推荐(0)
摘要: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of ... 阅读全文
posted @ 2015-04-29 11:02 TonyLuis 阅读(172) 评论(0) 推荐(0)
摘要: Write a function to find the longest common prefix string amongst an array of strings.解题思路:老实遍历即可,注意边界条件:JAVA实现: static public String longestCommonPre... 阅读全文
posted @ 2015-04-29 10:44 TonyLuis 阅读(179) 评论(0) 推荐(0)
摘要: Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.解题思路:类似上题,方法多多,本题直接给出上题中字典匹配的代码:JAVA实现:stati... 阅读全文
posted @ 2015-04-29 09:35 TonyLuis 阅读(165) 评论(0) 推荐(0)
摘要: Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.本题思路比较简单,难度主要集中在罗马数字本身,直接贴代码。思路一,从高位开始:JAVA:... 阅读全文
posted @ 2015-04-29 09:23 TonyLuis 阅读(168) 评论(0) 推荐(0)