上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 22 下一页
摘要: Find Peak ElementA peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and ... 阅读全文
posted @ 2015-07-01 23:43 `Liok 阅读(451) 评论(0) 推荐(0) 编辑
摘要: 4SumGiven an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum... 阅读全文
posted @ 2015-07-01 00:18 `Liok 阅读(559) 评论(1) 推荐(0) 编辑
摘要: 3Sum ClosestGiven an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three int... 阅读全文
posted @ 2015-06-29 22:48 `Liok 阅读(519) 评论(0) 推荐(0) 编辑
摘要: Majority Element IIGiven an integer array of sizen, find all elements that appear more than⌊ n/3 ⌋times. The algorithm should run in linear time and i... 阅读全文
posted @ 2015-06-29 17:53 `Liok 阅读(371) 评论(0) 推荐(0) 编辑
摘要: Maximum GapGiven an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/spac... 阅读全文
posted @ 2015-06-26 23:37 `Liok 阅读(396) 评论(0) 推荐(0) 编辑
摘要: Javascript中的Math.max方法可以求出给定参数中最大的数。> Math.max('1','2','3.1','3.2') Math.min(1,0,-1) Math.max.apply(null, ['1','2','3.1','3.2']) Math.min.apply(null, ... 阅读全文
posted @ 2015-06-26 15:35 `Liok 阅读(10123) 评论(0) 推荐(0) 编辑
摘要: Summary RangesGiven a sorted integer array without duplicates, return the summary of its ranges.For example, given[0,1,2,4,5,7], return["0->2","4->5",... 阅读全文
posted @ 2015-06-26 10:29 `Liok 阅读(372) 评论(0) 推荐(0) 编辑
摘要: Sqrt(x)Implementint sqrt(int x).Compute and return the square root ofx.https://leetcode.com/problems/sqrtx/对于数学早就还给老师的我,开方真是跪了。查了一下是牛顿迭代法(什么鬼。先随便猜一个数,... 阅读全文
posted @ 2015-06-25 22:57 `Liok 阅读(463) 评论(0) 推荐(0) 编辑
摘要: Pow(x, n)Implement pow(x,n).https://leetcode.com/problems/powx-n/注意x和n都可能是负数。递归,二分折半,比如求3的4次方,可以拆成3的2次方相乘;3的5次就是3^2相乘再乘2。 1 /** 2 * @param {number} x... 阅读全文
posted @ 2015-06-25 22:52 `Liok 阅读(774) 评论(0) 推荐(0) 编辑
摘要: Department Top Three SalariesTheEmployeetable holds all employees. Every employee has an Id, and there is also a column for the department Id.+----+--... 阅读全文
posted @ 2015-06-23 23:26 `Liok 阅读(639) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 22 下一页