PS4-4.Multi-level Code-breaking Did anyone meet the problem of "maximum recursion depth exceeded", i got this message quite a lot when n > 8. Is it possible to solve this problem without such deep recursion?
Every time you call a function from withina function the complete state of the calling function (variables, position etc.) is saved in memory. After a certain (generally large) number of such recursive calls free memory runs out. If the calling and the called functions are one, you are performing recursion. When memory runs out, no more recurson is possible.
@MikeR Thank you for your reply, i finally found why the depth of my recursion went to large. i missed the case when more than one blank character show up during the recursion, it caused the recursion always calls the same value and never stops.
Join our real-time social learning platform and learn together with your friends!