动态规划
HELLO_蓝猫
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
temp
docker pull amouat/identidock:unsignedexport DOCKER_CONTENT_TRUST=1docker pull debian:wheezydocker run -d --name influxdb -p 8086:8086 tutum/influxdbcreate database "cadvisor...原创 2019-12-17 11:26:24 · 285 阅读 · 0 评论 -
最长公共连续子序列
参考:https://www.cnblogs.com/fengziwei/p/7827959.html#include <iostream>#include <string>#include <algorithm>using namespace std;void DP() { string s1, s2; string ans = "";...原创 2019-05-13 11:08:40 · 336 阅读 · 0 评论 -
Leetcode 152. Maximum Product Subarray
152. Maximum Product SubarrayMedium159373FavoriteShareGiven an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product.E...原创 2018-12-31 14:26:50 · 284 阅读 · 0 评论 -
Leetcode 115. Distinct Subsequences
115. Distinct SubsequencesHard54125FavoriteShareGiven a string S and a string T, count the number of distinct subsequences of S which equals T.A subsequence of a string is a new string which i...原创 2018-12-29 16:17:56 · 480 阅读 · 0 评论 -
Leetocde 120. Triangle
class Solution {public: int minimumTotal(vector<vector<int>>& triangle) { //从下向上加 vector<int> minans(triangle.back()); for (int layer = triangle.size() - 2; layer ...原创 2018-09-07 12:06:27 · 167 阅读 · 0 评论 -
Leetcode 139. Word Break 动态规划
解法参考:https://blog.youkuaiyun.com/yujin753/article/details/48010677Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-sepa...原创 2018-07-06 13:16:58 · 467 阅读 · 0 评论 -
Leetcode 134. Gas Station
class Solution { public int canCompleteCircuit(int[] gas, int[] cost) { int ans=0;//从第一个开始试 //用gas-cost 连续加为正数的可以 负数不可以 int []temp=new int[gas.length]; for(int i=0;i<gas.length;i++) ...原创 2018-06-21 17:25:39 · 448 阅读 · 0 评论 -
Leetcode 112. Path Sum
112. Path SumDescriptionHintsSubmissionsDiscussSolutionPick OneGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the...原创 2018-05-08 11:03:48 · 160 阅读 · 0 评论 -
动态规划 硬币兑换
参考// 最少硬币.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>#include <vector>#include <map>#include <limits>using namespace std;class hh {public: vector&l...原创 2018-05-20 22:07:15 · 619 阅读 · 0 评论 -
Leetcode 91. Decode Ways
class Solution {public: //动态规划 连着两个能变成新的加1 反之等于dp[i-1] bool judge(string s) { int gewei,shiwei,ans; gewei = s[1] - '0'; shiwei = s[0] - '0'; ans = gewei + 10 * shiwei; return (ans > ...原创 2018-04-12 14:03:49 · 168 阅读 · 0 评论 -
北工大算法 作业2 动态规划 01背包问题
可以参考下面的文章 思路写的比较清晰https://blog.youkuaiyun.com/u010293698/article/details/48979623https://blog.youkuaiyun.com/sinat_22991367/article/details/51861373给定n种物品和一个背包,物品i的重量是wi,其价值为vi,背包的容量为C。背包问题是如何选择装入背包的物品,使得装入背包中物品的...原创 2018-04-03 16:20:02 · 519 阅读 · 0 评论 -
动态规划入门 数字三角形(POJ1163)
数字三角形(POJ1163)输入格式:5 //表示三角形的行数 接下来输入三角形73 88 1 02 7 4 44 5 2 6 5要求输出最大和与递归类似,分解成若干字问题,但相互直接有联系,每一层的最大值由下面那层而来。#include "stdafx.h"#include <iostream> #include &l...原创 2018-04-03 12:08:09 · 263 阅读 · 0 评论 -
Leetcode 97. Interleaving String
/*//分治法:如果首字母相同 就递归剩下的字符串 程序显而易见 但递归必然超时 所以用动态规划class Solution {public: bool isInterleave(string s1, string s2, string s3) { // Start typing your C/C++ solution below // DO NOT write int mai...原创 2018-04-08 14:28:53 · 150 阅读 · 0 评论 -
leetcode 72. Edit Distance
题解参考http://www.cnblogs.com/grandyang/p/4344107.html72. Edit DistanceDescriptionHintsSubmissionsDiscussSolutionPick OneGiven two words word1 and word2, find the minimum number of steps required to conv...原创 2018-04-07 23:41:49 · 176 阅读 · 0 评论
分享