I am getting TLE in my program … using for loops 2 times & it is showing TLE…how to optimize my algorithm?? plz help
Optimization will depend on type and category of problem. for example if problem is sorting then it can be optimized from O(n^2) to O(n) but not below that. Share your problem and solution,then only any one can help.
Vaguely I can just suggest, try to do a thing in linear time i.e O(n) time rather than O(n^2) if it is giving TLE.
if you use c++, then prefer scanf and printf over cin and cout, will compile quicker. i dont know any other trick yet.
Actually the problem is from live contest and that’s why I won’t be able to discuss it here…but thanks for the advice
yup. already using scanf & printf
are u sure u want to reduce the compilation time…