i did a dry run and didnt find any mistake, used bottom-up approach here. https://ide.codingblocks.com/s/286460
Why am i getting segmentation fault in this
i forgot to initialise the arr vector with size n, but im still getting segmentation fault after fixing that line as well
@Ishitagambhir,
Seg fault is because you are trying access an index out of bounds, for e.g before accessing dp[i+2][j], you are not ensuring that i+2<n;