Select Page

## Machine Learning: Simple Linear Regression

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...

## Sliding Window: Minimal Window of Array

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...

## Maximum Size Subarray Sum Equals K

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....

## 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...