need some help in few tricks to reduce my runtime

i always face runtime problem…
what should i do

If you are getting TLE, improve the time-complexity of your algorithm, as per the constraints given in the problem. If you feel that your algorithm is optimal and yet you are getting TLE, check again and remove certain redundant operations.
If you are talking about runtime errors, check the sizes of your arrays and change them to fit memory limits.

1 Like

Dont declare big data types unnecessarily. some time testcase will be below 10 use int and some time array size is also below 10^5 better use int then… declaring variables with big data types will make your code slow.

Try avoiding push_back in vectors ( if your r using vectors ) , try to arrays whenever possible. push_back operations is slow.

try to implement own queues and stacks using which are faster than STL

The above mentioned points may not save you from TLE but will definitely improves running time

Will Add Some More if I find any :slight_smile:

Happy Coding…

2 Likes
//