Prateek loves candy

how to solve the timelimit error in this code.
Ide —>https://ide.codingblocks.com/s/168114

You need to use prime seive optimisation in your code and you need to call that seive function before the test cases only so as to prevent the Time limit error…

I tried but still getting the same error

Pls share your code here so that I could make changes…

hey @mikkyimran, check this now
https://ide.codingblocks.com/s/169750

same problem sir. when submitting it is not showing anything

hey @mikkyimran, one of testcase has large value hence, it is taking too much time and giving TLE. If you make array of prime number before going for into loop, you won’t get any error. https://ide.codingblocks.com/s/169750

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.

1 Like