However, my solution that does not exceed 1e7 layers of recursion in this sample 33910932, yet it RTE's because of too deep recursion. (I had to write iterative solution to get AC)
Supposing each 64 bit int uses 8 bytes, and a pointer in a 64-bit compiler would take 8 bytes. 1e7 * 16 bytes = 160 megabytes.
Is there extra memory usage I am unaware about? Shouldn't this be able to squeeze under the size limit?