题意:Surround the TreesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 209 Accepted Submission(s): 104 Problem DescriptionThere are a lot of trees in...
分类:
其他好文 时间:
2015-03-17 15:50:50
阅读次数:
135
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 and the nodes have the same value.
这道题是要判断两棵树是不...
分类:
其他好文 时间:
2015-03-17 15:49:15
阅读次数:
88
Recover Binary Search Tree问题:Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A ...
分类:
其他好文 时间:
2015-03-17 15:41:16
阅读次数:
139
DescriptionValera loves his garden, wherenfruit trees grow.This year he will enjoy a great harvest! On thei-th treebifruit grow, they will ripen on a ...
分类:
其他好文 时间:
2015-03-17 14:03:32
阅读次数:
137
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110...
分类:
其他好文 时间:
2015-03-16 23:16:55
阅读次数:
331
题目: Given
a binary tree, determine if it is a valid binary search tree (BST).
知识点:BST的特点:
1、一个节点的左子树的所有点都小于或等于这个点的值,右子树的所有节点的值大于该节点的值;
2、最左节点值最小,最右节点值最大;
3、中序遍历结果值是一个非降的数列
问题:如果用Integer.MAX_VAL...
分类:
其他好文 时间:
2015-03-16 23:13:11
阅读次数:
149
Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ has binary representation 0000000000000...
分类:
其他好文 时间:
2015-03-16 23:09:57
阅读次数:
195
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(...
分类:
其他好文 时间:
2015-03-16 23:05:38
阅读次数:
181
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(...
分类:
其他好文 时间:
2015-03-16 23:03:51
阅读次数:
208
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(...
分类:
其他好文 时间:
2015-03-16 22:56:26
阅读次数:
116