Incorrect answer given

Should’nt the time complexity be nlogn