How to decide “Time Complexity” for your coding problem ?

I offer an immense pleasure for you showing up here. Being a computer science devotee proficient in Cloud Computing & Data Engineering, I have always looked forward in learning, sharing & gaining knowledge with overwhelming support of brilliant minds like you. With my deep regards, I hope this article will be able to reach out to the desire you wish to read ahead. Thankyou!

Kshitiz

If you have ever tried to solve a coding problem on any of the coding platforms, you must be relating to the image above in one way or so. The most common error we guys face during an attempt to crack a problem is that frustrating ‘Time Limit Exceeded’ or ‘TLE’ error. Even with so many modifications to what one can think to reduce it, I personally have faced a lot failures to this. Today we will understand the basic concept of time limit for a particular problem & how to avoid this error in the very first time.

The 10⁸ Operations Rule

Maximum valid time complexity for a given length range

Example

One keen observation you must have noticed from the above chart is that ‘Greater the input range, lesser should be the operations executed’. This concludes to the following graphical representation of the input-time relation in world of Algorithms.

Next time you put your hands on to write a code always make sure to follow this 10⁸ operations rule. At least the judge will not return that irritating TLE this time. I hope the above summary of entire concept must have given you an idea to decide the maximum level of complexity depth you can reach prior building a logic.

Thanks again for you to spending those precious couple of minutes of yours reading the article. For any query or suggestion please feel free to reach out:

It is..what it is..🖤