LeetCode
文章平均质量分 56
yoxibaga
这个作者很懒,什么都没留下…
展开
-
Find Minimum in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.算法分析:给定一个数组[a1,a2,a3……,an-1,an],不存在重复元素,求出其最小的元素。首先想到O(n)的算法,即遍历一次。看看O(logn)的算法:因为给定数组是排序数组经过旋转而得到的,因此若a1 > an,则该数组必原创 2014-12-03 15:05:55 · 547 阅读 · 0 评论 -
Intersection of Two Linked Lists
For example, the following two linked lists:A: a1 → a2 ↘ c1 → c2 → c3 ↗ B: b1 → b2 → b3begin to intersect at原创 2014-12-03 15:55:03 · 1548 阅读 · 0 评论 -
Maximum Product Subarray
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 contiguous subarray [2,3] has the largest原创 2014-12-08 22:28:53 · 524 阅读 · 0 评论