# LeetCode 213. House Robber II

House Robber II The trick is to find the max value between robbing 0 to n-2 and 1 to n-1, so that we avoid the rounding issue.

# LeetCode 152. Maximum Product Subarray

Maximum Product Subarray

# LeetCode 120. Triangle

Triangle. Surprisingly, this problem can be solved by the same method as in Pascal’s Triangle.

# LeetCode 115. Distinct Subsequences

Distinct Subsequences. Classic DP problem. Define dp[i,j] is the number of distinct subsequences between s[0..j-1] and t[0..i-1]. (it is a bit tedious on the subscript) Then if s[j] == t[i]…

# LeetCode 91. Decode Ways

Decode Ways. I solve this problem by using DP with some careful case handling. Define DP[i] define the number of decoding ways end at position i. You can checkout the…

# LeetCode 64. Minimum Path Sum

Minimum Path Sum. Still using the same DP traverse method as Unique Paths. But this time since we are finding the minimum path sum, so instead of sum two paths together,…

# LeetCode 63. Unique Paths II

Unique Paths II. Same as Unique Paths. But DP[i,j] = 0 if position i,j are an obstacles.

# LeetCode 62. Unique Paths

Unique Paths. I solve this problem by using DP. Define DP[i,j] to be the number of paths from the start point to position i,j. The we know DP[i,j] = DP[i-1,j]…