摘要: Binary Tree Inorder TraversalGiven a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ... 阅读全文
posted @ 2014-12-02 21:09 陆草纯 阅读(242) 评论(0) 推荐(0)
摘要: Unique Binary Search Trees IIGivenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your pr... 阅读全文
posted @ 2014-12-02 20:02 陆草纯 阅读(2736) 评论(0) 推荐(0)
摘要: Unique Binary Search TreesGivenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a to... 阅读全文
posted @ 2014-12-02 18:31 陆草纯 阅读(291) 评论(0) 推荐(0)
摘要: Interleaving StringGivens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", r... 阅读全文
posted @ 2014-12-02 16:32 陆草纯 阅读(4866) 评论(0) 推荐(0)
摘要: Validate Binary Search TreeGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtre... 阅读全文
posted @ 2014-12-02 14:44 陆草纯 阅读(252) 评论(0) 推荐(0)
摘要: Recover Binary Search TreeTwo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A sol... 阅读全文
posted @ 2014-12-02 13:00 陆草纯 阅读(836) 评论(0) 推荐(0)