# | Title | Solution | Time | Space | Difficulty | Note |
740 | O(n) | O(1) | Medium | DP | ||
1137 | O(log(n)) | O(1) | Easy | DP, Matrix Exponentiation, Variant of Fibonacci number #509 | ||
746 | O(n) | O(1) | Easy | DP | ||
198 | O(n) | O(1) | Medium | DP | ||
121 | O(n) | O(1) | Easy | Array | ||
97 | O(n*m) | O(n+m) | Medium | DP | ||
983 | O(n) | O(1) | Medium | DP | ||
790 | O(log(n)) | O(1) | Medium | DP, Matrix Exponentiation | ||
1155 | O(d*f*t) | O(t) | Medium | DP, | ||
718 | O(n*m) | O(min(n,m)) | Medium | Backtracking, DP, Hash, Binary Search | ||
1220 | O(log(n)) | O(1) | Hard | DP, Matrix Exponentiation | ||
1473 | O(m*t*n^2) | O(t*n) | Hard | DP | ||
265 | O(n*k) | O(k) | Hard | Premium, DP | ||
256 | O(n) | O(1) | Medium | Premium, DP, | ||
714 | O(n) | O(1) | Medium | DP | ||
931 | O(n^2) | O(1) | Medium | DP | ||
64 | O(n*m) | O(n+m) | Medium | DP, | ||
63 | O(n*m) | O(n+m) | Medium | DP, | ||
62 | O(m+n) | O(1) | Medium | DP, Combinatorics | ||
918 | O(n) | O(1) | Medium | Array | ||
91 | O(n) | O(1) | Medium | DP | ||
518 | O(n*m) | O(m) | Medium | DP, | ||
276 | O(n) | O(1) | Medium | Premium, DP | ||
309 | O(n) | O(1) | Medium | DP | ||
188 | O(n) | O(n) | Hard | DP, Quick Select, Mono Stack | ||
300 | O(n log(n)) | O(n) | Medium | DP, Binary Search, Segment Tree | ||
139 | O(n*l^2) | O(n) | Medium | DP | ||
322 | O(n*k) | O(k) | Medium | DP | ||
1335 | O(d*n^2) | O(d*n) | Hard | DP | ||
221 | O(n^2) | O(n) | Medium | DP | ||
1143 | O(n*m) | O(min(n,m)) | Medium | DP, | ||
1770 | O(m^2) | O(m) | Hard | DP |
#265) here are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color.
The cost of painting each house with a certain color is represented by an n x k cost matrix costs.
Return the minimum cost to paint all houses.
#256) There is a row of n houses, where each house can be painted one of three colors: red, blue, or green. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color.
The cost of painting each house with a certain color is represented by an n x 3 cost matrix costs.
Return the minimum cost to paint all houses.
#276) You are painting a fence of n posts with k different colors. You must paint the posts following these rules:
Given the two integers n and k, return the number of ways you can paint the fence.