• + 1 comment

    Dynamic memory is not the correct way to handle this. The correct way is to use an iterative solution rather than the recursive solution.