I dont know why code is not working
I have brought it down to two loops
hello @adityamehrotra275
that will still give tle.
store all ur prime number upto 10^6 in an array and the use that array to answer each query efficiently
oh so that way I dont have to iterate 10^3 times and iterate only n times.
…
for each query u dont have to iterate ,simply print using computed array in single step.
so that means I simply do cout<<Arr[n]
…
yeah…, once check the code that i shared for clarity…
Got it this indeed must be the most optimized way
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.