Prateek Loves Candy


Why is this not working?

@tanyaa.sood your loop iterator i in the function prime_seive needs to be long long!

How do we know when to use long long and when to use only int?

you are computing i * i and since i can be as large as 10^6 that means i * i can be as large as 10^12 which needs to be stored in long long int. and since during the calculation of i * i, i will be used as accumulator i needs to be able to accumulate i*i so i needs to be long long.