I am getting TLE in my program … using for loops 2 times & it is showing TLE…how to optimize my algorithm?? plz help

# how to reduce compilation time in C ??

**c0d3_k1ra**#2

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.

**garakchy**#3

if you use c++, then prefer scanf and printf over cin and cout, will compile quicker. i dont know any other trick yet.

**shantanu10**#4

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