问题: Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number. An example is the root-to-leaf path1->2->3whic ...
分类:
其他好文 时间:
2017-08-18 14:31:04
阅读次数:
209
Write a function to print spiral order traversal of a binary tree. For below tree, function should print 1, 2, 3, 4, 5, 6, 7. Solution. For a normal l ...
分类:
其他好文 时间:
2017-08-18 14:30:31
阅读次数:
136
LeetCode解题之Binary Tree Inorder Traversal 原题 不用递归来实现树的中序遍历。 注意点: 无 样例: 输入: {1,#,2,3} 1 \ 2 / 3 输出: [1,3,2] 解题思路 通过栈来实现,从根节点開始,不断寻找左节点,并把这些节点依次压入栈内。仅仅有在 ...
分类:
其他好文 时间:
2017-08-18 11:07:02
阅读次数:
138
问题: Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tree{1,#,2,3}, return[1,2,3]. 递归方法: 非递归方法(利用栈): ...
分类:
其他好文 时间:
2017-08-18 11:06:35
阅读次数:
118
一 路由系统 URL 1 url(r'^index/',views.index) url(r'^home/', views.Home.as_view()) 2 url(r'^detail-(\d+).html',views.detail),#动态路由 views.py def detail(requ ...
分类:
编程语言 时间:
2017-08-18 00:03:33
阅读次数:
280
先上英文文档: Convert an integer number to a binary string prefixed with “0b”. The result is a valid Python expression. If x is not a Python int object, it ...
分类:
编程语言 时间:
2017-08-18 00:02:19
阅读次数:
316
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. ...
分类:
其他好文 时间:
2017-08-17 23:33:04
阅读次数:
178
/bin:bin是Binary的缩写,该目录下存放的是最常用的命令。 /boot:该目录下存放的是启动Linux时使用的一些核心文件,包括一些连接文件以及镜像文件。 /dev:dev是Device(设备)的缩写。该目录下存放的是Linux的外部设备。在Linux中,访问设备的方式和访问文件的方式是相同的..
分类:
系统相关 时间:
2017-08-17 21:25:54
阅读次数:
175
stl 中迭代器能够理解为面向对象版本号的广义指针,提供了对容器中的对象的訪问方法,能够遍历容器全部元素。也能够訪问随意元素。stl 迭代器有下面五种: Input iterators 仅仅读,输入迭代器,支持如:istreamOutput iterators 仅仅写,输出迭代器。支持如:ostre ...
分类:
其他好文 时间:
2017-08-17 19:59:30
阅读次数:
107
bool CopyFile(const std::string &src, const std::string &dest) { std::ifstream fin(src.c_str(), std::ios::in | std::ios::binary); if(!fin) { std::cout... ...
分类:
编程语言 时间:
2017-08-17 17:16:36
阅读次数:
123