testcase 3 - run error
please check.
Array challenges (prime visits)
a and b can be upto 10^9 and u r running prime seive between a and b that is a<n<b
there array didnt have that much of size thats why run error come
optimize it
I didn’t get u…size of arr is also 100005 and a and b are b/w 10^6…so whats the prblm in this ques???
thats b-a is between
a and b get t0 10^9
like
b=1000000000 and a can be any ranging from
1000000000-1000000 to 1000000000
and u r making a loop from a to b and calling prime seive every time
this make ur run error
I’ve made changes. Could u plz chck it.
1<=m<=n<=1000000000, n-m<=100000 this is th contraint
and u r checking if b<1000000 4
b-a should be less than 1000000
not a and b they can be upto 10^9
but constraints are this:
a<=1000000 & b<=1000000. N<=1000
can u plz correct my code
can u post the link of the question
check this
i hope this clear your doubt
Actually ur runtime error is coming due to loop in the prime seive as u have declare j as int but i*i can be greater than int thats why j can have a garbage a negative value so thats why run time error comes
Thank you so much …now i get it