code : https://ide.codingblocks.com/s/242977
all test cases are passing except one test case
hello @chaman9
store prime numbers upto 10^6 in some array/vector.
then answer each query using this array/vector in O(1).
i did that this one case failing
can you correct my code
ur array a and p length should be size + 1. becuase u want to access index upto size.
i did that also
its still not working.
u should add one more zero in ur size.
because in question prime can be upto 10^6. u have defined as 10^5
bhai wo bhi kar liya…
ab kya aa raha hai . . . ?
/bin/run.sh: line 4: 17 Segmentation fault (core dumped) ./exe
ye wala error
p ,a,aur size ko global bana do.
kuch is tarah

reason -> global scope ki memory capacity jayda hoti hai function scope se
this worked bro… pr why const keyword
global array ke arguments mein hamesa const assign hota hai otherwise compiler error dega.
jaise ke -> int arr[100] or arr[some variable ] (give that variable should be constant)
Thanks a lot… samj gya