Error in Prime visits

Its showing test case 3: time limit exceeded error in my program whereas the other two cases have been passed.

Hi @Pranshu_gupta, pls save your code on ide.codingblocks.com and share the link here.

https://ide.codingblocks.com/s/72126

Hi @Pranshu_gupta, its showing Time-Limit Exceeded becuase your program will take more time than 1sec for large inputs. While your algo is perfect for small numbers and for small value of n-m, it’s unsuitable for large numbers or for large value of n-m. You have to solve this question with the help of Seive Of Eratosthenes. Pls study that topic in your course and then attempt this question.