Can someone tell the time complexity of my solution


#1
int check(vector<int>v,int n){
    sort(v.begin()+n,v.end());
    return v[v.size()-1];
}
vector<int> Solution::solve(vector<int> &A) {
    vector<int>ans;
    for(int i=0;i<A.size();i++){
        if(A[i]==check(A,i)) ans.push_back(A[i]);
    }
    return ans;
}

#2

The worst case complexity is O((n^2)*logn).