Simple CPP two line code , TC O(n)

int Solution::solve(vector &A) {

sort(A.begin(),A.end());
return A[A.size()-1];

}

sort function itself takes O(nLogn) time

Click here to start solving coding interview questions