by Xiaokang Zhang | Feb 5, 2017 | Algorithm & Data Structure
Let’s first take a look at simple linear regression. First let’s start with an open question: imagine you can get all the information you need, how do you predict the selling price of a house? I believe you might consider the following factors: House...
by Xiaokang Zhang | Jan 24, 2017 | Algorithm & Data Structure
Sliding Window Sliding window is a common approach in solving algorithm problems, it has a few elements: Window start and endStatus of elements in the windowWindow extends to the right according to the statusWindow shrinks to the right according to the statusWindow...
by Xiaokang Zhang | Jan 24, 2017 | Algorithm & Data Structure
Maximum Size subarray problem Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn’t one, return 0 instead. Note:The sum of the entire nums array is guaranteed to fit within the 32-bit signed integer range....
by Xiaokang Zhang | Jan 23, 2017 | Algorithm & Data Structure
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...
by Xiaokang Zhang | Jan 23, 2017 | Algorithm & Data Structure
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...
by Xiaokang Zhang | Jan 23, 2017 | Algorithm & Data Structure
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...