LeetCode 128 Longest Consecutive Sequence

Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2, 3, 4]. Return its length: 4. Your algorithm should run in O(n) complexity.     继续阅读
Xin Wei's avatar
Xin Wei 11月 30, 2015
 | 

LeetCode 4 Median of Two Sorted Arrays

    继续阅读
Xin Wei's avatar
Xin Wei 11月 30, 2015
 | 

LeetCode 154 Find Minimum in Rotated Sorted Array II

Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. The array may contain duplicates.     继续阅读
Xin Wei's avatar
Xin Wei 11月 29, 2015
 |