uacs2024

导航

2022年10月31日 #

leetcode429-N 叉树的层序遍历

摘要: 429. N 叉树的层序遍历 BFS非递归,自己写的。 /* // Definition for a Node. class Node { public: int val; vector<Node*> children; Node() {} Node(int _val) { val = _val; 阅读全文

posted @ 2022-10-31 16:40 ᶜʸᵃⁿ 阅读(10) 评论(0) 推荐(0) 编辑

leetcode199-二叉树的右视图

摘要: 199. 二叉树的右视图 这道题BFS很容易想到。但DFS没想出来。 这是BFS vector<int> rightSideView(TreeNode* root) { if(root==nullptr) return {}; queue<TreeNode*> qqq; vector<int> re 阅读全文

posted @ 2022-10-31 15:38 ᶜʸᵃⁿ 阅读(9) 评论(0) 推荐(0) 编辑