TLE being shown despite of using sieve approach. Please help.
Prateek loves candy problem
problem is you that
you are calculating seive array for each testcase
instead you have to calculate seive only once and then ans all testcases
Modified Code
now it passes all testcases
i hope you doubt is resolved
if yes then plz give feedback from link below
if not feel free to ask
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.