Tag: dynamic programming
The Matrix Chain Multiplication Problem is the classic example for Dynamic Programming. If there are three matrices: A, B and C. The total number of multiplication for (A*B)*C and …
Given an index k, return the k-th row of the Pascal’s triangle. For example, given k = 3, Return . Could you optimize your algorithm to use only O(k) …
The puzzle is to generate the first few numRows rows of Pascal’s Triangle. Do you need to keep each row in separate variables (row vector)? Apparently no. The trick …
This puzzle is from Leetcode Online Judge and this may appear quite often during interviews. This puzzle asks you to find the minimal sum for a number triangle. You …
We all know that the total number of solution to pick combination of n items out of m items is C(m, n), and sometimes denoted as or . We …