i am getting the timelimit exceed in my code
my code: https://ide.codingblocks.com/s/100858
Getting timelimit exceeded in testcase
Try using Prime sieves concept to optimize your program , it is one of the optimal way to find the prime numbers .
You are getting TLE error because your code is taking more then the allotted time to solve this problem.
ok let me try thanks for the idea
how can i make an array in python. or does list works like array in python
how can i make an array in python. or does list works like array in python
i tried to impiment the seieve of Erastosthenes but still in am getting 2nd testcase wrong my code: https://ide.codingblocks.com/s/100995
This is how you use sieves -
Create a list of consecutive integers from 2 to n: (2, 3, 4, …, n).
Initially, let p equal 2, the first prime number.
Starting from p, count up in increments of p and mark each of these numbers greater than p itself in the list. These numbers will be 2p, 3p, 4p, etc.; note that some of them may have already been marked.
Find the first number greater than p in the list that is not marked. If there was no such number, stop. Otherwise, let p now equal this number (which is the next prime), and repeat from step 3.
Rest i will look in your code for the problem and let you know
Your code seems right , I just checked the test case and it was -
1
1000000000 1000100000
3 5
The test case is not correct itself
so how can get full score in it, what if you guys alter the testcases:face_with_raised_eyebrow:
or what should i do
I will mention you in this thread itself so you will get a notification about it and inform you that the test case has been changed
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.