From 4e9ff712f71005b45e6ac0d7fbc2b0f0b779710e Mon Sep 17 00:00:00 2001 From: xiaoyu2018 <861900161@qq.com> Date: Sun, 25 Sep 2022 16:23:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A00062=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E8=B7=AF=E5=BE=84C#=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0062.不同路径.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/problems/0062.不同路径.md b/problems/0062.不同路径.md index 5790df69..79e49b87 100644 --- a/problems/0062.不同路径.md +++ b/problems/0062.不同路径.md @@ -452,5 +452,25 @@ object Solution { } ``` +### c# + +```c# +public class Solution +{ + public int UniquePaths(int m, int n) + { + int[] dp = new int[n]; + for (int i = 0; i < n; i++) + dp[i] = 1; + for (int i = 1; i < m; i++) + for (int j = 1; j < n; j++) + dp[j] += dp[j - 1]; + return dp[n - 1]; + } +} +``` + + + -----------------------