Prateek bhaiya loves candy problem

why I am getting TLE error

make 2 changes

  1. make size of array 7400000
    this is because The 500,000th prime is 7,368,787.

  2. make seive only once for that call is_prime fucntion outside the loop

Modified Code

1 Like