LintCode
qq_30163523
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【原创,禁止转载】单词拆分问题
解决思路采用字典树查询提高查询效率中间可能需要回溯,用堆栈保存需要回溯的状态#include <iostream>#include <set>#include <vector>#include <unordered_set>#include <unordered_map>using namespace std;class Solution {public: /* * @p原创 2017-12-30 11:11:02 · 767 阅读 · 0 评论 -
【原创】最长公共子序列
dp[i][j] 表示第一个字符串的前i个字符与第二个字符的前j个字符构成的公共子序列的长度最优子结构: #include <iostream>#include <string>#include <vector>#include <set>using namespace std;class Solution {public: /* * @param A: A strin原创 2017-12-30 11:24:49 · 234 阅读 · 0 评论 -
背包问题2
最优子结构: #include <iostream>#include <vector>using namespace std;class Solution {public: /** * @param m: An integer m denotes the size of a backpack * @param A: Given n items with size A[i原创 2017-12-30 11:38:48 · 268 阅读 · 0 评论 -
【原创】背包问题
思路:动态规划。背包剩余容量为j,已决定前i个物品是否放入时,最大价值为dp[i][j](此问题中为放入的物品总重量)最优子结构: #include <iostream>#include <vector>using namespace std;class Solution {public: /** * @param m: An integer m denotes the siz原创 2017-12-30 11:33:10 · 235 阅读 · 0 评论
分享