Hi everyone. In this video, let's look at problem 653 from leetcode. I forgot to mention both time and space complexity. Both complexities would be O(n), where n is the size of this BST.
I didn't use the fact that this is a BST. Using the fact that the given input is BST, you can improve the space complexity to O(h), but time complexity will remain the same.
#leetcode #python #programming #algorithm #codinginterviews #coding #binarysearchtree