So I was trying to solve this problem: Link
I got a TLE, my submission
I'm not sure if the solution is correct but I want to know why am I getting TLE, I think my solution is O(n), buy maybe because the numbers are too big I'm miscalculating something. I've added comments to my code too please let me know why is getting TLE. Thanks!
You have overflow here:
i * i <= minn
Note that you are dividing/modding by 64-bit numbers. Since the size is fixed, the operation takes O(1). Generally I think 64-bit is about twice as slow as 32-bit, but it is quite fast in any case. If you were dividing by arbitrarily large numbers, then it's implementation dependent but apparently it can be as fast as O(nlog n), where n is the number of bits in the number. I think the nlog n algorithm has a terrible constant though :P (https://en.wikipedia.org/wiki/Computational_complexity_of_mathematical_operations#Arithmetic_functions)