Mathematics practice

problem link : https://hack.codingblocks.com/app/practice/3/p/63

my code : https://ide.codingblocks.com/s/188529

I got TLE.

Help!

@prateek_5 Your function no of primes is not returning anything so please write void in front of it as data type.

In line number 16 write
void no_of_prime

Issue persists.
It still says TLE.

@prateek_5 The method you are using would surely give tle.
You have to use seive for precomputing the primes elements and then query in 0(1) to check if a number is prime or not.

1 Like

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.