当前位置:网站首页>leetcode 120. Triangle minimum path sum
leetcode 120. Triangle minimum path sum
2022-06-11 15:24:00 【Amnesia machine】

Dynamic programming problem .dp Array , The equation is dp[j][i] = Math.min(dp[j+1][i],dp[j+1][i+1]) + At present value value .
java The code is as follows
class Solution {
public int minimumTotal(List<List<Integer>> triangle) {
int n = triangle.size();
int[][] dp = new int[n+1][n+1];
for(int j = n - 1; j >= 0; j--){
for(int i = 0; i <= j; i++){
dp[j][i] = Math.min(dp[j+1][i],dp[j+1][i+1]) + triangle.get(j).get(i);
}
}
return dp[0][0];
}
}边栏推荐
- 【创建型模式】原型模式
- Number system conversion (function)
- Taking log4j as an example, how to evaluate and classify security risks
- Nexus of repository manager
- Iclr2022| small sample fine tuning method of language model based on differentiable hints
- How to batch insert 100000 pieces of data
- 线程实战入门【硬核慎入!】
- 19. insertion, deletion and pruning of binary search tree
- 容易让单片机程序跑飞的原因
- C interface of learning notes
猜你喜欢

Tencent interviewers share their interview experience, how to evaluate the interviewers' technical and personal comprehensive quality, and give you some suggestions on the interview

Hot seek tiger, a list of eco economic models

2022.02.28

Let me tell you the benefits of code refactoring

07 _ 行锁功过:怎么减少行锁对性能的影响?

浅析分布式系统之体系结构-事务与隔离级别(多对象、多操作)下篇

02 _ Log system: how does an SQL UPDATE statement execute?

uniapp開發微信小程序,從構建到上線
![[process blocks and methods of SystemVerilog] ~ domain, always process block, initial process block, function, task, life cycle](/img/c7/ff28df36b8d5dda704aa829dd5264f.png)
[process blocks and methods of SystemVerilog] ~ domain, always process block, initial process block, function, task, life cycle

【创建型模式】抽象工厂模式
随机推荐
在微服务架构中管理技术债务
[mysql_12] MySQL data types
Uniapp développe des applets Wechat, de la construction à la mise en ligne
Safepoint explanation and analysis of its placement ideas
CNCF survey in 2021: a year for kubernetes to cross the gap
社交软件Soul撤回IPO申请:上市只差临门一脚 腾讯是大股东
When open source meets KPI, globalization vs localization, how can the ideal and reality of open source be reconciled?
The server prevents repeated payment of orders
简单的C语言版本通讯录
Tangzhengrong: CTO is the intersection of business thinking and technical thinking
浅析分布式系统之体系结构-事务与隔离级别(多对象、多操作)下篇
浅谈居家办公后的感想| 社区征文
NVIDIA R & D director: how does AI improve chip design?
leetcode 120. 三角形最小路径和
硬核分析懒汉式单例
safePoint讲解及其安插思路分析
[azure application service] nodejs express + msal realizes the authentication experiment of API Application token authentication (AAD oauth2 idtoken) -- passport authenticate()
容易让单片机程序跑飞的原因
英伟达研发主管:AI 是如何改进芯片设计的?
回溯法/解空间树 排列树