I cant understand why iam getting TLE error in implementation of prime sieve
here is the code:
I cant understand why iam getting TLE error in implementation of prime sieve
here is the code:
you have done some mistakes
for (int i = 3; i <= n; i + 2)
it should be for (int i = 3; i <= n; i+=2)
arr[i] = 1; line no10
you are marking every i to be 1 which not correct
you have to do it initially ,seperately
modified code
okk , thanks…
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.