I don't know why the stack was overflwing

https://ide.geeksforgeeks.org/36kRYuyf7v

for this code when I submitted then y stack was overflowing…and instead of memoizatin I needed to use DP approach…I want to know what was the problem…

Memoization uses extra space for stack. You may have exceeded the memory limit of the question.