TLE for 2 test cases

Despite implementing exactly what was shown in the tutorial i am getting a TLE for 2 test cases. Can’t figure out what is wrong. Are any further optimizations possible?

I Have checked your code it is correct
and when i submit it passes all testcase

please check again and try to submit again

yeah it did pass all cases now…there might have been some issue… Thankyou btw.