Gettingwrong answer of Deepak and primes challange
@Jun18APP0112 your logic is wrong somehow it is giving wrong answer for many queries.
for this question you should use Sieve of Eratosthenes to store prime numbers.
but this approach is faster. can you please tell for what case it is giving wrong answer
showing timelimit exceed
instead of calling prime function every time make an array and store every prime number in it and just print arr[n-1] as your answer
this code is showing run time error for n=5000000
take MAX_SIZE as 10^8 it will work fine.
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.