one testcase is getting wrong please help, i have written the correct code. Here is my code:
DOUBT IN Deepak and Primes II
See contraints , what if b = 1000000000 and ( b - a ) = 100000 , your solution will run O(sqrt(b) * (b-a) ) which leads to TLE.
Use proper segmented sieve.
Refer this-:
Thanks Rated you 5 stars !
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.