I am solving the KPRIME Problem. I have created a global 2D array of size 6 by N(1e5 + 2). I am getting segmentation fault, I have pinpointed the line which is giving me seg fault by printing it with the i value.
If I reduce the N to 1e4, the code runs properly, is it due to large allocation ?
Printed the value:
cout<<"i :"<<i<<" pf[i] "<<prime_factor_nos[i]<<" "<<table[prime_factor_nos[i]][i]<<nl
Seg fault occurs at i = 30015
i :30014 pf[i] 3 0 i :