my code is giving wrong answer for lis-top down approach please help code:
#include
using namespace std;
int lis(int *arr,int i,in
t j,int n)
{
if( arr[j] <arr[i] || j==n)
{
return 0;
}
int inc=1+lis(arr,i,j+1,n);
int ex=lis(arr,i,j+1,n);
int x=max(inc,ex);
return x;
}
int main()
{
int n;
cin>>n;
int a[1000];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
cout<<lis(a,0,0,n);
}