the program runs fine for small inputs but gives run error for other test cases
Deepak and primes II ,getting run error
2 issues in your code:
- have not handled the indices of array arr appropriately. it was accessing index equal to its size.
- elimination in array arr should start from a value which is close to m. otherwise time complexity will be nearly nlogn. but it should be (n-m)logn.
updated code: https://ide.codingblocks.com/s/218348
thanks