recursive code is correct but on including dp array, segmentation fault is occuring
Recursive code correct but giving error on including dp array
@akshatkaush,
Statically allocating dp is too much for 1e4*1e4, you can use dynamic allocation by using vectors.
Check here.