03 2015 档案

摘要:Implementint sqrt(int x).Compute and return the square root ofx.解题思路1,o(log(n)):像这种从初始遍历查找匹配的任务,往往可以使用二分法逐渐缩小范围;初始从0~x/2 + 1,然后逐渐以二分思想缩小查找范围。解题思路2:牛顿迭... 阅读全文
posted @ 2015-03-18 02:50 胡潇 阅读(144) 评论(0) 推荐(0)
摘要:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?解题思路1,时间复杂度o(n):顺时针... 阅读全文
posted @ 2015-03-15 06:22 胡潇 阅读(184) 评论(0) 推荐(0)
摘要:Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,... 阅读全文
posted @ 2015-03-13 21:59 胡潇 阅读(285) 评论(0) 推荐(0)
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2,1,... 阅读全文
posted @ 2015-03-10 22:42 胡潇 阅读(234) 评论(0) 推荐(0)
摘要:Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega... 阅读全文
posted @ 2015-03-10 02:04 胡潇 阅读(195) 评论(0) 推荐(0)
摘要:Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated num... 阅读全文
posted @ 2015-03-06 04:44 胡潇 阅读(161) 评论(0) 推荐(0)
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the... 阅读全文
posted @ 2015-03-05 06:02 胡潇 阅读(127) 评论(0) 推荐(0)
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element.You m... 阅读全文
posted @ 2015-03-04 07:38 胡潇 阅读(154) 评论(0) 推荐(0)
摘要:All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to ... 阅读全文
posted @ 2015-03-03 05:33 胡潇 阅读(252) 评论(0) 推荐(0)
摘要:Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文
posted @ 2015-03-02 10:52 胡潇 阅读(138) 评论(0) 推荐(0)