Recursion could hit the stack size if the depth of the tree is very very large.


  • 0
    A

    Should not we switch to iterative solution if we determine (or specified upfront) the depth tree to be very large.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.