July 6, 2015
problem statement:
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] has the largest sum = 6.
Study the code:
http://joycelearning.blogspot.ca/2013/10/leetcode-maximum-subarray.html
the contiguous subarray [4,−1,2,1] has the largest sum = 6.
Study the code:
http://joycelearning.blogspot.ca/2013/10/leetcode-maximum-subarray.html
C# code:
https://github.com/jianminchen/MaximumSubArray/blob/master/Program.cshttps://github.com/jianminchen/MaximumSubArray_Space/blob/master/Program.cs
More reading:
1. Keyword lookup:
DP problem: Kadane's algorithm, maximum subarray sum
DP problem: Kadane's algorithm, maximum subarray sum
2. Write a program to find the sum of contiguous
subarray within a one-dimensional array of numbers which has the largest sum.
January 3, 2015
Review the question.
Here is the link of C# solution:
https://github.com/jianminchen/Leetcode_C-/blob/master/53MaximumSubArray1.cshttps://github.com/jianminchen/Leetcode_C-/blob/master/53MaximumSubArray2.cs
study code:
http://joycelearning.blogspot.ca/2013/10/leetcode-maximum-subarray.html
https://github.com/xiaoxq/leetcode-cpp/blob/master/src/MaximumSubarray.cpp
No comments:
Post a Comment