recusion use a lot of memory, any idea why?

2024-02-27 Thread IanZhang
Thanks! this make a lot of sense.

recusion use a lot of memory, any idea why?

2024-02-26 Thread IanZhang
Code below is solving . When use recursion call, It used a lot of memory. I tried use input as var, but still on effect. Have to change code to iterative to solve the memory problem. Any idea why recusion call use so much memory, is there some mistake in my