From ce5ee6905be7cede2cf1825954b820288a173543 Mon Sep 17 00:00:00 2001 From: linlihong <747682928@qq.com> Date: Fri, 27 Sep 2024 17:29:27 +0800 Subject: [PATCH] =?UTF-8?q?2024/9/27=20Hot100=20=E5=A4=9A=E7=BB=B4dp?= =?UTF-8?q?=E5=92=8C=E6=AF=8F=E6=97=A5=E4=B8=80=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/cool/hot100/multi_dp/Num64.java | 62 +++++++++++++++++++ .../LeetCode20240927.java | 49 +++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 src/main/java/com/cool/hot100/multi_dp/Num64.java create mode 100644 src/main/java/com/cool/one_question_per_day/LeetCode20240927.java diff --git a/src/main/java/com/cool/hot100/multi_dp/Num64.java b/src/main/java/com/cool/hot100/multi_dp/Num64.java new file mode 100644 index 0000000..e8536c4 --- /dev/null +++ b/src/main/java/com/cool/hot100/multi_dp/Num64.java @@ -0,0 +1,62 @@ +package com.cool.hot100.multi_dp; + +/** + * Created with IntelliJ IDEA. + * + * @Author: Cool + * @Date: 2024/09/27/14:28 + * DayNumber 2 + * Hard 2 + * Level ? + * @Description 64. 最小路径和 + * @Link https://leetcode.cn/problems/minimum-path-sum/description/?envType=study-plan-v2&envId=top-100-liked + */ +public class Num64 { + + public int minPathSum(int[][] grid) { + if(grid.length==0){ + return 0; + } + int[][]dp=new int[grid.length][grid[0].length]; + dp[0][0]=grid[0][0]; + for(int i=1;i