Playing with Cards(in stack)

Whats error in this code? 1 test case is passing only

hello @nilotpal
a)
ur c will get initialsied by 1 again n again for evry function call so while(c<q) will never stop
b) every time u are finding nth prime which is time consuming and may cause tle.
store all primes in vector and then use it .

for reference ->


Can you see this. I corrected that part. Still TLE is coming

nevermind. Its done. thanks

ok :ok_hand:

…
…
…

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.