###########################################################################
#                                                                         #
# Author: Daniel Mock                                                     #
#                                                                         #
# Purpose: To document progress in learning algorithms & data structures  #
#                                                                         #
# References: This question was generated by leetcode.com. The solution   #
# to the question was generated by Daniel Mock.                           #
#                                                                         #
###########################################################################


class Solution:
    def postorderTraversal(self, root: TreeNode) -> List[int]:
        ret_arr = []
        self.recurse(root, ret_arr)
        return ret_arr

    def recurse(self, root, ret_arr):
        if root:
            self.recurse(root.left, ret_arr)
            self.recurse(root.right, ret_arr)
            ret_arr.append(root.val)
            return ret_arr
