![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode div & conquer
proudmore
这个作者很懒,什么都没留下…
展开
-
Leetcode Pow(x,n) 和 sqrt(x)
pow(x,n)[code]public class Solution { public double pow(double x, int n) { if(x==0)return 0; if(n==0)return 1; boolean negative= n<0; n=Math.abs(n); double h原创 2015-03-21 02:09:01 · 156 阅读 · 0 评论 -
Leetcode Skyline
A city’s skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are given the locations and height of all the buildings as原创 2015-05-29 09:40:01 · 221 阅读 · 0 评论 -
Leetcode Pow(x,n)
divide conquer. 注意正负,overflowpublic class Solution { public double myPow(double x, int n) { int sign= (n%2==0 || x>0) ? 1 :-1; x=Math.abs(x); if(x==0 ||x==1)return sign*x;原创 2015-06-22 07:52:37 · 161 阅读 · 0 评论 -
Leetcode Kth Largetst element
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example, Given [3,2,1,5,6,4] and k = 2, return 5.Note:原创 2015-06-02 10:55:16 · 192 阅读 · 0 评论