
Divide and Conquer
文章平均质量分 74
豆腐脑是咸的
这个作者很懒,什么都没留下…
展开
-
Maximum Subarray (Java)
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,−5,4], the contiguous subarray [4,−1,2,1] ha原创 2015-01-18 11:16:03 · 1014 阅读 · 0 评论 -
Merge k Sorted Lists (Java)
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. merge two sorted lists那道题的升级版。 Source /** * Definition for singly-linked list. * public class原创 2015-02-06 18:49:26 · 388 阅读 · 0 评论 -
Median of Two Sorted Arrays (Java)
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). 参考:http://blog.youkuaiyun.com/yutianzui原创 2015-02-12 15:31:42 · 424 阅读 · 0 评论 -
Majority Element (Java)
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority element原创 2014-12-22 14:25:20 · 953 阅读 · 0 评论