The K-th Distance
Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 202 Accepted Submission(s): 50
Problem Description
Given a tree, w...
分类:
其他好文 时间:
2014-11-09 13:59:19
阅读次数:
376
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".二进制数想加,并且保存在string中,要注意的是如何将string和int之间互相转换,并且...
分类:
其他好文 时间:
2014-11-09 13:43:01
阅读次数:
178
二叉树的各种遍历方法有 前序遍历 中序遍历 后序遍历 层序遍历。其中前三种遍历有递归程序可以实现,但是我们也有必要掌握其非递归版本的算法实现。正好在leetcode中遇到了遍历二叉树的问题,今天在这里一并总结了。首先,引用leetcode中关于二叉树节点的定义。1 // Definition ...
分类:
编程语言 时间:
2014-11-09 12:37:56
阅读次数:
329
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ...
分类:
其他好文 时间:
2014-11-09 07:30:45
阅读次数:
155
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n...
分类:
其他好文 时间:
2014-11-09 06:19:31
阅读次数:
173
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
分类:
其他好文 时间:
2014-11-09 06:18:31
阅读次数:
179
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an...
分类:
其他好文 时间:
2014-11-09 06:16:58
阅读次数:
170
Given inorder and postorder traversal of a tree, construct the binary tree.Solution: 1 /** 2 * Definition for binary tree 3 * public class TreeNode .....
分类:
其他好文 时间:
2014-11-09 06:16:44
阅读次数:
215
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For ...
分类:
其他好文 时间:
2014-11-09 06:13:51
阅读次数:
122
Given a very large n-ary tree. Where the root node has some information which it wants to pass to all of its children down to the leaves with the cons...
分类:
其他好文 时间:
2014-11-09 06:13:47
阅读次数:
177