Question Link:-https://www.hackerearth.com/practice/math/number-theory/basic-number-theory-2/practice-problems/algorithm/nearest-prime-a828361b/
Code link:-https://ide.codingblocks.com/s/383484
Please check! What’s wrong with my approach?
Question Link:-https://www.hackerearth.com/practice/math/number-theory/basic-number-theory-2/practice-problems/algorithm/nearest-prime-a828361b/
Code link:-https://ide.codingblocks.com/s/383484
Please check! What’s wrong with my approach?
You are not pushing all the primes to the vector
Since outer loop is running for i*i<=n
Now, it’s printing on online ide but when I try to submit on hacker earth it gives “Segmentation Fault”.