How can i resolvde this error


int Solution::lis(const vector &A) {
int n=A.size();
if(n==0) return 0;
vector inc(n, 0);
int res=1;
for(int i=1;i<n;i++){

    auto itr=lower_bound(A.begin(), A.begin() + res, A[i]);
    if(itr == A.begin() + res)
    inc[res++] = A[i];
    *itr  = A[i]; 
return res;


It shows the error:
solution.cpp: In member function ‘int Solution::lis(const std::vector<int>&)’:
solution.cpp:13:15: error: assignment of read-only location ‘itr.__gnu_cxx::__normal_iterator<const int*, std::vector<int> >::operator*()’
17 | *itr = A[i];