随笔分类 -  动态规划

栅栏染色
摘要:class Solution {public: /* * @param n: non-negative integer, n posts * @param k: non-negative integer, k colors * @return: an integer, the total numbe 阅读全文
posted @ 2017-11-05 23:17 叶尘 阅读(119) 评论(0) 推荐(0)
最长上升连续子序列
摘要:class Solution {public: /* * @param A: An array of Integer * @return: an integer */ int longestIncreasingContinuousSubsequence(vector<int> &A) { // wr 阅读全文
posted @ 2017-11-05 23:16 叶尘 阅读(90) 评论(0) 推荐(0)
不同的路径 II
摘要:class Solution {public: /* * @param obstacleGrid: A list of lists of integers * @return: An integer */ int uniquePathsWithObstacles(vector<vector<int> 阅读全文
posted @ 2017-11-05 23:13 叶尘 阅读(106) 评论(0) 推荐(0)
不同的路径
摘要:class Solution {public: /* * @param m: positive integer (1 <= m <= 100) * @param n: positive integer (1 <= n <= 100) * @return: An integer */ int uniq 阅读全文
posted @ 2017-11-05 23:10 叶尘 阅读(112) 评论(0) 推荐(0)
爬楼梯
摘要:当爬第k阶楼梯时,有可能是从第k-1或k-2阶楼梯上过去的,所以到达第k阶楼梯的方法为到达第k-1与k-2阶楼梯的方法之和 class Solution {public: /** * @param n: An integer * @return: An integer */ int climbSta 阅读全文
posted @ 2017-11-05 23:08 叶尘 阅读(104) 评论(0) 推荐(0)
最小路径和
摘要:class Solution {public: /* * @param grid: a list of lists of integers * @return: An integer, minimizes the sum of all numbers along its path */ int mi 阅读全文
posted @ 2017-11-05 23:04 叶尘 阅读(101) 评论(0) 推荐(0)
数字三角形
摘要:class Solution {public: /* * @param triangle: a list of lists of integers * @return: An integer, minimum path sum */ int minimumTotal(vector<vector<in 阅读全文
posted @ 2017-11-05 23:02 叶尘 阅读(104) 评论(0) 推荐(0)