将二叉树拆成链表
来源:互联网 发布:php oa 工作流引擎 编辑:程序博客网 时间:2024/06/16 06:27
class Solution {public: /** * @param root: a TreeNode, the root of the binary tree * @return: nothing */ // TreeNode *x; // x=new TreeNode; vector<int> a; void look(TreeNode *root) { if(root==NULL) return ; a.push_back(root->val); look(root->left); look(root->right); } void flatten(TreeNode *root) { look(root); TreeNode *x; x=new TreeNode; x=root; for(int i=0;i<a.size();i++) { x->val=a[i]; x->left=NULL; if(i!=a.size()-1) x->right=new TreeNode; x=x->right; } // write your code here // x->right=NULL; }};
0 0
- 将二叉树拆成链表
- LintCode: 将二叉树拆成链表
- 将二叉树拆成链表
- lintcode,将二叉树拆成链表
- LintCode 将二叉树拆成链表
- 将二叉树拆成链表-LintCode
- 将二叉树拆成链表
- 将二叉树拆成链表
- lintcode 将二叉树拆成链表
- 将二叉树拆成链表
- 将二叉树拆成链表
- lintcode将二叉树拆成链表
- 将二叉树拆成链表
- 将二叉树拆成链表
- 将二叉树拆成链表
- 将二叉树拆成链表
- 将二叉树拆成链表
- 将二叉树拆成链表
- 并查集 模板
- caffe2 安装与介绍
- Hrbust 1742 Enclosure Plan【二维前缀和+尺取法】
- 未来已来,如何成为一名人工智能产品经理
- 子查询
- 将二叉树拆成链表
- [2017.4.19]IMWEB前端小白训练营日记(五)
- 初学Hibernate,从建立项目,配置文件到实现对单表的增删改查
- XMU 1606 nc与滴水问题 【模拟】
- hiho Coder hiho字符串
- 翻转二叉树
- 练习
- python装饰器
- 漫谈千亿级数据优化实践:数据倾斜(纯干货)