How could the space complexity is O(1)? if you use stack?


  • 0

    Most solution use stack to record the middle point.
    But it will take log(n) space to store the middle point until you reach the deepest left node.

    Why it is O(1) space???


Log in to reply
 

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