Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0076152

Browse files
committed
Update 0343.整数拆分,添加C#
1 parent 08617fd commit 0076152

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

‎problems/0343.整数拆分.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,25 @@ class Solution {
496496
}
497497
}
498498
```
499+
### C#
500+
```csharp
501+
public class Solution
502+
{
503+
public int IntegerBreak(int n)
504+
{
505+
int[] dp = new int[n + 1];
506+
dp[2] = 1;
507+
for (int i = 3; i <= n; i++)
508+
{
509+
for (int j = 1; j <= i / 2; j++)
510+
{
511+
dp[i] = Math.Max(dp[i],Math.Max(j*(i-j),j*dp[i-j]));
512+
}
513+
}
514+
return dp[n];
515+
}
516+
}
517+
```
499518

500519
<p align="center">
501520
<a href="https://programmercarl.com/other/kstar.html" target="_blank">

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /