How to fix time limit error in this code

@AjAy03
The constraints mentioned in this question are large and you have to work for multiple testcases. You need to use Sieve Technique which is discussed in Number Theory Section in your course. Sieve is an optimised technique to precompute prime numbers and will help you resolve the TLE.

1 Like