Prateek Love.Candy

WHY TIMELIMIT ERROR??I M USING SIEVE OF ERATOSTENES…

hey Divyam, you are getting timelimit error beacuse you are checking all value of prime sieve in main function.
solution to this issue: it will be good if you create an array that contains prime numbers only and then checking over this array only. consider this code https://ide.codingblocks.com/s/78822

Thanks gaurav ! it worked now.

hey Divyam, if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved

1 Like