Leetcode: Binary Tree Inorder Traversal
来源:互联网 发布:linux 查找文件夹大小 编辑:程序博客网 时间:2024/04/28 21:33
//the key is to use a stack smartlyclass Solution {public: vector<int> inorderTraversal(TreeNode *root) { // Start typing your C/C++ solution below // DO NOT write int main() function //if(root==NULL) //return NULL; stack<TreeNode*> s; vector<int> v; v.clear(); TreeNode* np=root; while(1){ while(np){ s.push(np); np=np->left; } if(s.empty()) break; TreeNode* tmp=s.top(); s.pop(); v.push_back(tmp->val); np=tmp->right; } return v; }
- LeetCode: Binary Tree Inorder Traversal
- [LeetCode]Binary Tree Inorder Traversal
- LeetCode Binary Tree Inorder Traversal
- [Leetcode] Binary Tree Inorder Traversal
- Leetcode: Binary Tree Inorder Traversal
- LeetCode Binary Tree Inorder Traversal
- LeetCode : Binary Tree Inorder Traversal
- [Leetcode] Binary Tree Inorder Traversal
- 【leetcode】Binary Tree Inorder Traversal
- [LeetCode]Binary Tree Inorder Traversal
- Leetcode: Binary Tree Inorder Traversal
- [leetcode]Binary Tree Inorder Traversal
- LeetCode-Binary Tree Inorder Traversal
- Leetcode Binary Tree Inorder Traversal
- [leetcode] Binary Tree Inorder Traversal
- LeetCode - Binary Tree Inorder Traversal
- [LeetCode] Binary Tree Inorder Traversal
- LeetCode | Binary Tree Inorder Traversal
- C++/CLI的泛型
- 结对编程
- ASP三层架构中可能出现的问题总结
- 仿Lightinthebox模版快速修改教程
- Maven基本知识点总结
- Leetcode: Binary Tree Inorder Traversal
- pci 总结
- Scrapy爬虫教程之URL解析与递归爬取
- NGUI之多Camera响应事件
- vim load templates python
- Nginx.conf介绍
- 打开eclipse出现Incompatible JVM解决方法
- Swing界面刷新问题
- Jquery 常用方法经典总结