Skip to content

Commit 15d6db8

Browse files
Update longest_bitonic_subsequence.cpp
1 parent bf309df commit 15d6db8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

DP/LongestBitonicSubseq/longest_bitonic_subsequence.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using namespace std;
44
//Longest Increasing Decreasing Subsequence
55
int lidss(int n,int arr[])
66
{
7-
if(n==0)
7+
if(n==0)
88
return 0;
99
int lenI[n];
1010
int lenD[n];
@@ -39,17 +39,17 @@ int lidss(int n,int arr[])
3939
}
4040
}
4141

42-
//calculate longest Increasing and then decreasing subsequence starting from each element
43-
int max=1;
44-
for(int i=0;i<n;i++)
45-
{
46-
int len=lenI[i]+lenD[i]-1;
47-
if(max<len)
48-
{
49-
max=len;
50-
}
51-
}
52-
return max;
42+
//calculate longest Increasing and then decreasing subsequence starting from each element
43+
int max=1;
44+
for(int i=0;i<n;i++)
45+
{
46+
int len=lenI[i]+lenD[i]-1;
47+
if(max<len)
48+
{
49+
max=len;
50+
}
51+
}
52+
return max;
5353
}
5454

5555
int main() {

0 commit comments

Comments
 (0)