I was trying to solve this problem:
The code that I wrote (using memoization) is :
However, if I input strings abc and ab, I get segmentation fault. I tried debugging it on onlineGDB, but I am not sure why I get segmentation fault.
Please guide about why there is segmentation fault and send the corrected code