What is problem in my code /// longest increasing subsequence

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define INF 50000000000009999ll
using ld = long double;
using ull = unsigned long long;
int dp[105][105];
int find(vector arr,int low,int high,int num)
{
int ans=0;
while(low<=high)
{
int mid=(low+high)/2;
if(arr[mid]<=num)
{
ans=mid;
low=mid+1;
}
else
high=mid-1;
}
return ans;
}
int solve(vector arr)
{
int n=arr.size();
if(n==0)
return 0;
vector tail(n);
tail[0]=arr[0];
int len=1;
for(int i=1;i<n;i++)
{
if(arr[i] < tail[0])
tail[0]=arr[i];
else if(arr[i] > tail[len-1])
tail[len++]=arr[i];
else
{
int idx=find(arr,0,len-1,arr[i]);
tail[idx]=arr[i];
}
}
return len;

}
int main()
{
int n;
cin>>n;
vector arr(n);
for(int i=0;i<n;i++)
cin>>arr[i];
cout<<solve(arr);

return 0;

}