摘要: https://www.cnblogs.com/grandyang/p/4518674.html 第一个和最后一个数字不可以同时选择,所以分为两种情况计算,分别是[0...m-1]和[1....m],取最大值。 计算每个位置的最大值时,该位置i的最大值只和i-1、i-2的值有关。 class Sol 阅读全文
posted @ 2020-05-07 10:37 qiujiejie 阅读(111) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/grandyang/p/4295761.html class Solution { public: int maxProfit(int k, vector<int>& prices) { if(prices.empty()) return 0; if( 阅读全文
posted @ 2020-05-07 09:05 qiujiejie 阅读(127) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/grandyang/p/4233035.html dp[i][j]表示当前位置的最小起始血量;从右下往左上推。 class Solution { public: int calculateMinimumHP(vector<vector<int>>& d 阅读全文
posted @ 2020-05-06 10:02 qiujiejie 阅读(103) 评论(0) 推荐(0) 编辑
摘要: leetcode 139 word break class Solution { public: bool wordBreak(string s, vector<string>& wordDict) { unordered_set<string> wordset(wordDict.begin(),w 阅读全文
posted @ 2020-05-05 10:05 qiujiejie 阅读(136) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/grandyang/p/4271456.html leetcode 132 https://www.cnblogs.com/grandyang/p/7404777.html leetcode 647 将字符串切割为回文的最小切割数:动态规划 p[i][ 阅读全文
posted @ 2020-05-04 18:12 qiujiejie 阅读(126) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/grandyang/p/4294105.html 不同的子序列: 动态规划,dp[i][j]代表s[0...i]中t[0...j]有的个数。写出矩阵,找规律。 class Solution { public: int numDistinct(strin 阅读全文
posted @ 2020-05-04 17:09 qiujiejie 阅读(102) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/grandyang/p/4298664.html 动态规划,dp[i][j]为true表示s1[i-1]可以与s3[i+j-1]匹配或s2[j-1]可以与s3[i+j-1]匹配 class Solution { public: bool isInter 阅读全文
posted @ 2020-04-28 14:26 qiujiejie 阅读(145) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/grandyang/p/4301096.html https://www.cnblogs.com/grandyang/p/4299608.html 卡塔兰数:https://zh.wikipedia.org/wiki/%E5%8D%A1%E5%A1%9 阅读全文
posted @ 2020-04-23 10:36 qiujiejie 阅读(149) 评论(0) 推荐(0) 编辑
摘要: https://www.cnblogs.com/grandyang/p/4313384.html 动态规划,如果当前数字不为0,则当前数字可以单独转换,有dp[i-1]种方法(dp[i-1]的每一种方法都加上当前的转换);如果和前面一个数字组成的数字大于0,小于27,s[i-2]和s[i-1]可以转 阅读全文
posted @ 2020-04-23 09:27 qiujiejie 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 1. 安装wine:https://tipsonubuntu.com/2019/02/01/install-wine-4-0-ubuntu-18-10-16-04-14-04/ 1)enable 32 bit architecture: sudo dpkg --add-architecture i3 阅读全文
posted @ 2020-04-22 19:54 qiujiejie 阅读(870) 评论(0) 推荐(0) 编辑