How to determine if my program is gonna give TLE ??

help
aug17
long-contest
questions
tle

#1

I have recently tried solving the questions in the long challenge, in the greedy candidates questions I tried implementing it in java and got 2.1s and TLE, how to understand why it gave TLE and how to overcome it??


#2

Dont use scanner class for taking input. In that 2 second time, I bet that a huge chunk of your time is taken in just taking input. Google and copy the Fast I/O template of java, and re-run the same code.


#3

Use Buffer Reader or any other fast I/O template for taking input.
Also, in case you didn’t know about time complexity, this link will be helpful!


#4

please use fast i/o


#5

I found an answer for this question in detail here

I hope you will find it helpful.


#6

thanks a lot!


#7

thanks a lot!


#8

thanks a lot!