随笔分类 - 动态规划
栅栏染色
摘要:class Solution {public: /* * @param n: non-negative integer, n posts * @param k: non-negative integer, k colors * @return: an integer, the total numbe
阅读全文
最长上升连续子序列
摘要:class Solution {public: /* * @param A: An array of Integer * @return: an integer */ int longestIncreasingContinuousSubsequence(vector<int> &A) { // wr
阅读全文
不同的路径 II
摘要:class Solution {public: /* * @param obstacleGrid: A list of lists of integers * @return: An integer */ int uniquePathsWithObstacles(vector<vector<int>
阅读全文
不同的路径
摘要:class Solution {public: /* * @param m: positive integer (1 <= m <= 100) * @param n: positive integer (1 <= n <= 100) * @return: An integer */ int uniq
阅读全文
爬楼梯
摘要:当爬第k阶楼梯时,有可能是从第k-1或k-2阶楼梯上过去的,所以到达第k阶楼梯的方法为到达第k-1与k-2阶楼梯的方法之和 class Solution {public: /** * @param n: An integer * @return: An integer */ int climbSta
阅读全文
最小路径和
摘要: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
阅读全文
浙公网安备 33010602011771号