In prime visit time limit exceed

time limit exceed
in the third test case

Hello @Shivam31,

Please share your code.
It would be easier to detect bug.

You are getting TLE because the logic you are using to check if a number is prime number, is brute force.

Thus, it is taking time more than required.
You must have heard of sieve of eratosthenes to compute prime numbers.
You have a video regarding the same in your course.

I would suggest you to try this method as it is an efficient way of doing this.
Hope, this would help.

If you still face any issue, feel free to ask.
Don’t forget to share the link of IDE where you would save your code.:blush: