Why my test case is showing error time limit exceed.Can we solve this question without using 3 loops so that our time complexity get reduced.
Generally why program show TLE error?
TLE(Time limit Exceed)
the constraint on number of test cases, It’s quite large because for every test case you are going to find the prime numbers upto that number and at last return the last prime number found, this will cause the TLE for big test cases.
- So, to overcome this problem, let’s just store your test cases in an array.
- Then find the maximum number from all of the testcases.
- then, Use SOE(Sieve of Eratosthenes) to find the prime number upto that number and store that an the array.
- After storing, simply loop over every test case that was stored previously in an array.
- Print the value of n from the array storing primes.
That’s how we need not to find the prime number for every test case. 
try to understand this code here by debugging through it
can we solve this question without an array?What is the error in my boolean approach and how to resolve this error plzz explain.
you can refer to this to understand tle better
your approach wont clear tle looking at the the constrains
Mam can u please explain me the code provided by u using array and arraylist so that i can better understand the solution.
Main logic behind the question is that you need to find the nth prime number starting from 2. Any one can implement this logic “Not a big Deal” for anyone, but wait a min there’s more to it.
Many of you are getting time limit exceed right ? Even if you are using SOE (Sieve of Eratosthenes) for finding the prime numbers.
Have u see the constraint on number of test cases, It’s quite large because for every test case you are going to find the prime numbers upto that number and at last return the last prime number found, this will cause the TLE for big test cases.
- So, to overcome this problem, let’s just store your test cases in an array.
- Then find the maximum number from all of the testcases.
- then, Use SOE(Sieve of Eratosthenes) to find the prime number upto that number and store that an the array.
- After storing, simply loop over every test case that was stored previously in an array.
- Print the value of n from the array storing primes.
That’s how we need not to find the prime number for every test case. 
Mam im able to understand the concept behind it but i’m unable to implement it in code can u please help me out with the code provided by u earlier.
In Prateeklovescandy function what is the use of the max variable? 2-we are passing max value at the end of of the loop we get 5 stored in the max variable(for n=2,input given 1 and 5)How this works?