Bottom-up recursion in tree problems

For example, for the balanced binary tree problem (https://leetcode.com/problems/balanced-binary-tree/).

If you want to do bottom-up recursion (to make the runtime linear), just do the recursive call before dealing with the root! (This is a postorder traversal)


uid: 202006211748 tags: #interviews


Date
February 22, 2023