题解 | #二叉树的中序遍历#

二叉树的中序遍历

https://www.nowcoder.com/practice/0bf071c135e64ee2a027783b80bf781d

class Solution {
public:
    void lur(vector<int>& ret,TreeNode* root)
    {
        if(root == nullptr) return ;
        lur(ret,root->left);
        ret.push_back(root->val);
        lur(ret,root->right);
    }
    vector<int> inorderTraversal(TreeNode* root) {
        // write code here
        vector<int> ret;
        lur(ret,root);
        return ret;
    }
};

全部评论

相关推荐

01-12 17:45
门头沟学院 Java
叁六玖:这样的应该钱不多,以前我也被问,我在问他们实习公工资多少,一般都是2200-2800
找实习记录
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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