Estimate program time

Like here time is 0.1 - 0.107125 secs given… and in the video we use brute force for n<130… How did he make out that brute force will clear the time limit given that O(n^4) would be the complexity.,…How can we estimate that a particular time complexity code would fit in given time limit ??

It depends on many things . on an average in 1 sec a loop can execute 10^8 to 2^8 times. it also depends on compiler. If you are getting a sol which is taking less than 10^8 iterations of loop you can go for that logic…

1 Like