https://ide.codingblocks.com/s/53585
is there any way to reduce the time taken by this code
Prateek loves candy@!
Yes use sieve approach to store all the primes initially in O(n log n) complexity and then solve each query in O(1)
1 Like