Movatterモバイル変換


[0]ホーム

URL:


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

Commite8dc7cc

Browse files
authored
Merge pull requestneetcode-gh#998 from agnihotriketan/patch-3
C# 300-Longest-Increasing-Subsequence.cs
2 parents9673f8b +7f1dbd2 commite8dc7cc

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
publicclassSolution{
2+
publicintLengthOfLIS(int[]nums){
3+
int[]dp=newint[nums.Length];
4+
Array.Fill(dp,1);
5+
6+
for(inti=nums.Length-1;i>=0;i--)
7+
{
8+
for(intj=i+1;j<nums.Length;j++)
9+
{
10+
if(nums[i]<nums[j])
11+
{
12+
dp[i]=Math.Max(dp[i],1+dp[j]);
13+
}
14+
}
15+
}
16+
returndp.Max();
17+
}
18+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp