Maximum Product Subarray

Maximum Product Subarray Problem 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 product = 6. Reduction Transition...

Maximum Subarray

Maximum Subarray Problem 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. Reduction Transition...

Largest Rectangle in Histogram

Largest Rectangle in Histogram Problem Given n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the histogram. The following is a histogram with the width of bar of 1, and...