Why its showing TLE?
@supratik260699
n can be upto 200000, so increase the size of temp to 200000. Just change line 10 to int temp[200000];
@supratik260699
n can be upto 200000, so increase the size of temp to 200000. Just change line 10 to int temp[200000];