https://how2.sh/posts/how-to-write-recursive-algorithms-without-stack-overflow/
How to Write Recursive Algorithms Without Stack Overflow