当前位置: 首页 > news >正文

网站建设的技术标准苏州网络推广服务

网站建设的技术标准,苏州网络推广服务,美食网站 怎么做,哪个网站能买到做披萨的芝士正宗通过递归到记忆化搜索再到严格表结构的动态规划 递归方法的评价:1. 单可变参数的维度;2. 可变参数的个数 记忆化搜索 在暴力递归中会存在很多的重复计算,可以使用存储结构来实现空间换时间。 严格表结构的动态规划 整理位置之间的依赖关系…

通过递归到记忆化搜索再到严格表结构的动态规划

递归方法的评价:1. 单可变参数的维度;2. 可变参数的个数

记忆化搜索

在暴力递归中会存在很多的重复计算,可以使用存储结构来实现空间换时间。

严格表结构的动态规划

整理位置之间的依赖关系来达到进一步优化的效果。

322. 零钱兑换 - 力扣(LeetCode)https://leetcode.cn/problems/coin-change/

class Solution {
public:int coinChange(vector<int>& coins, int amount) {vector<int> count(amount+1 ,amount+1);count[0] = 0;for(auto coin : coins){for(int i = coin ; i<=amount ; i++){count[i] = min(count[i] , count[i-coin]+1);}}return count[amount]==amount+1?-1:count[amount];}
};

518. 零钱兑换 II - 力扣(LeetCode)https://leetcode.cn/problems/coin-change-ii/

class Solution {
public:int change(int amount, vector<int>& coins) {vector<int> count(amount+1 , 0);count[0] = 1;for(auto coin : coins){for(int i = coin ; i<=amount ; i++){count[i] += count[i-coin];}}return count[amount];}
};

剑指 Offer 42. 连续子数组的最大和 - 力扣(LeetCode)icon-default.png?t=N176https://leetcode.cn/problems/lian-xu-zi-shu-zu-de-zui-da-he-lcof/?envType=study-plan&id=lcof&plan=lcof&plan_progress=jkqqk9t

class Solution {
public:int maxSubArray(vector<int>& nums) {int res = nums[0] , pre = 0;for(auto &num : nums){pre = max(pre+num , num);res = max(res , pre);}return res;}
};

剑指 Offer 47. 礼物的最大价值 - 力扣(LeetCode)icon-default.png?t=N176https://leetcode.cn/problems/li-wu-de-zui-da-jie-zhi-lcof/?envType=study-plan&id=lcof&plan=lcof&plan_progress=jkqqk9t

// class Solution {
// public:
//     int process(vector<vector<int>>& grid , int x , int y , vector<vector<int>>& dp){
//         if(x==grid.size()||y==grid[0].size())return 0;
//         if(dp[x][y]!=0)return dp[x][y];
//         dp[x][y] = grid[x][y] + max(process(grid, x+1, y, dp), process(grid, x, y+1, dp));
//         return dp[x][y];
//     }//     int maxValue(vector<vector<int>>& grid) {
//         vector<vector<int>> dp(grid.size() , vector<int>(grid[0].size() , 0));
//         return process(grid, 0, 0, dp);
//     }
// };class Solution {
public:int maxValue(vector<vector<int>>& grid) {vector<int> dp(grid[0].size()+1 , 0);for(int i = grid.size()-1 ; i>=0 ; i--){for(int j = dp.size()-2 ; j>=0 ; j--){dp[j] = max(dp[j] , dp[j+1]) + grid[i][j];}}return dp[0];}
};

http://www.hrbkazy.com/news/44403.html

相关文章:

  • 重庆网站建设设计公司信息谷歌优化方法
  • 做化学题的网站怎么买域名自己做网站
  • 网站做ssl证书有风险网络运营师
  • 做网站需要学啥bing搜索国内版
  • 上海网站seo设计yoast seo教程
  • 福永网站建设公司郑州seo外包
  • 厦门网站建设模板网络优化工具app手机版
  • 网站代码输入完成之后要怎么做steam交易链接可以随便给别人吗
  • 做58同城这样的网站有哪些凡科建站平台
  • 怎么做网站二级页面百度直播间
  • 建设网站 织梦今日最新闻
  • 重庆泡笋制作怎么进行网站关键词优化
  • 免费的个人网站注册天津搜索引擎优化
  • 网站建设公司中百度竞价
  • 偃师做网站海外网络推广服务
  • 怎么看网站有没有做404佛山网络推广平台
  • 网站设计公司业务怎么做如何在百度搜索到自己的网站
  • wap网站制作开发公司seo关键词挖掘工具
  • 深圳外网站建设郑州网络推广效果
  • wordpress writr潍坊关键词优化平台
  • 锦州网站建设动态谷歌seo怎么优化
  • IT男做网站域名注册平台哪个好
  • 那个公司建站好南宁seo规则
  • 服务型政府网站建设软文营销怎么做
  • 淡水网站建设公司网络网站推广选择乐云seo
  • 上海知名网站建设公司排名怎么联系百度推广
  • 网站开发需要什么软件360广告投放平台
  • 做网站赚钱 2017整站seo怎么做
  • 重庆市建设工程信息网官网造价seo优化就业前景
  • 网站上的客服女排联赛最新排行榜