Is there any iterative solution with O(1) space for this question?

  • 0

    I wonder if one could write a code iteratively, without extra space, and without overhead of recursive calls, so I wonder if we could write O(1) code for this question?

  • 0

    You need a new tree node for every member of the array, so it's O(n) space.

Log in to reply

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