The problem:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.My analysis:The problem is easy at some extent,...
分类:
其他好文 时间:
2015-01-09 12:15:07
阅读次数:
108
Error executing row event: 'Cannot execute statement: impossible to write to binary log since statement is in row format and BINLOG_FORMAT = STATEMENT...
分类:
数据库 时间:
2015-01-09 12:11:21
阅读次数:
707
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
编程语言 时间:
2015-01-09 08:04:12
阅读次数:
289
The problem:Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(...
分类:
其他好文 时间:
2015-01-09 06:54:36
阅读次数:
132
https://oj.leetcode.com/problems/binary-tree-preorder-traversal/http://blog.csdn.net/linhuanmars/article/details/21428647/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassSolu..
分类:
其他好文 时间:
2015-01-09 01:52:30
阅读次数:
274
erlang提供了两个函数用于erlang数据与二进制的转换,term_to_binary 把erlang数据转成一个二进制数据,binary_to_term 则是把二进制数据转为原始的erlang数据。这两个函数都是c实现的,效率很高,可用于序列化和反序列化数据,可以被直接用来当作网络封包协议。文章主要探讨这种二进制协议数据的组织形式,以及用erlang语言实现binary_to_term...
分类:
编程语言 时间:
2015-01-09 01:35:30
阅读次数:
282
The problem: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 con...
分类:
其他好文 时间:
2015-01-09 00:07:50
阅读次数:
208
QUESTIONImplement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will retur...
分类:
其他好文 时间:
2015-01-08 23:57:45
阅读次数:
282
问题描述:
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
基本思想:
与Largest Rectangle in Histogram
思想类似,只是对每行都执行了一遍。
代码:
int ma...
分类:
其他好文 时间:
2015-01-08 22:47:03
阅读次数:
166
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2015-01-08 20:06:49
阅读次数:
131