题解 | #25.二叉树的后序遍历#

二叉树的后序遍历

http://www.nowcoder.com/practice/1291064f4d5d4bdeaefbf0dd47d78541

后序

function postorderTraversal( root ) {
    function postOrder(root){
      if(root == null)  return;
      postOrder(root.left);
      postOrder(root.right);
      res.push(root.val);
    }
    let res = [];
    postOrder(root);
    return res;
}
module.exports = {
    postorderTraversal : postorderTraversal
};
全部评论

相关推荐

10-02 19:29
已编辑
浙江科技大学 运营
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务