since I’m getting time limit exceeded for one test case, what can be a more optimised solution ??
Regarding Prime Visits problem
You have to use Sieve of Eratosthenes for primes in this problem. The test cases are large and so without this it will give TLE. Lecture video of Sieve of Eratosthenes is there in the Number Theory section of your course. Please refer that first and then try to solve this problem using that concept.
You can refer this:
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.