soapyigu/LeetCode-Swift

Space complexity of solution to Maximum Depth Of Binary Tree

snapfinger opened this issue · 1 comments

The space complexity was specified as O(1) in the solution, however because of recursion, considering the stack, should it be O(n) instead?

@snapfinger Yes you are correct. Space complexity of the solution should be O(n).
@soapyigu Should I raise the PR to fix this?