Prateek recently graduated from college. To celebrate, he went to a candy shop and bought all the candies. The total cost was a number upto which there are n prime numbers (starting from 2). Since Prateek wants to minimize his cost, he calls you to help him find the minimum amount that needs to be paid. Being a student of Prateek bhaiya it is now your job to help him out 
Please explain this question I am unable to understand it?
hey @Nitya_Somani
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.
I have not completed arrays lectures as it is after challenges and SOE also so it’s more confusing !
not completed arrays lectures
Skip this for now
okay sure will skip it