https://leetcode.com/problems/same-tree/Same TreeGiven two binary trees, write a function to check if they are equal or not.Two binary trees are consi...
分类:
编程语言 时间:
2015-05-16 18:07:57
阅读次数:
130
题目:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 ...
分类:
其他好文 时间:
2015-05-16 17:57:57
阅读次数:
107
题意:题意比较简单就是二叉树的中序遍历
思路:1. 递归是最简单的了
2. 非递归的实现:用一个stack做存储结构
一直查找leftchild 知道没有下一个leftchild,访问该元素
如果该元素有right child 加入stack
从stack中取出一个元素 重复上述行为(这里需要加入set集合记录访问过得left的节点 否则会出现重复访问的问题)
代码:
...
分类:
其他好文 时间:
2015-05-16 16:34:34
阅读次数:
100
题目:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. ...
分类:
其他好文 时间:
2015-05-16 16:23:31
阅读次数:
92
Huge Tree(0856)问题描述There are N trees in a forest. At first, each tree contains only one node as its root. And each node is marked with a number.You're...
分类:
其他好文 时间:
2015-05-16 16:12:37
阅读次数:
115
Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100".解题思路:JAVA实现如下:static public String addBinar...
分类:
编程语言 时间:
2015-05-16 13:16:18
阅读次数:
172
题目:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.代码:/** * De...
分类:
其他好文 时间:
2015-05-16 13:12:01
阅读次数:
116
地址:https://oj.leetcode.com/problems/maximal-rectangle/Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones...
分类:
其他好文 时间:
2015-05-16 11:54:21
阅读次数:
176
题目:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.代码:/** * Def...
分类:
其他好文 时间:
2015-05-16 11:53:57
阅读次数:
141
首先声明:我们要构建的是扩展或者模块名为hello_module.该模块提供一个方法:hello_word.一、PHP环境的搭建1)一般使用源码包编译安装,而不是binary包安装。因为使用PHP的二进制分发包安装有些冒险,这些版本倾向于忽略./configure的两个重要选项,它们在开发过程中很便...
分类:
Web程序 时间:
2015-05-16 00:03:15
阅读次数:
283