上一页 1 2 3 4 5 6 7 ··· 16 下一页

Leetcode:Merge Sorted Array

摘要: Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal... 阅读全文
posted @ 2015-01-06 14:14 Ryan-Xing 阅读(153) 评论(0) 推荐(0) 编辑

Leetcode:Binary Search Tree Iterator

摘要: Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the next... 阅读全文
posted @ 2015-01-06 12:41 Ryan-Xing 阅读(219) 评论(0) 推荐(0) 编辑

Leetcode:Unique Binary Search Trees

摘要: 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. 1... 阅读全文
posted @ 2015-01-05 23:53 Ryan-Xing 阅读(176) 评论(0) 推荐(0) 编辑

Leetcode:Symmetric Tree

摘要: 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 / \ ... 阅读全文
posted @ 2015-01-02 20:57 Ryan-Xing 阅读(171) 评论(0) 推荐(0) 编辑

Leetcode:Same Tree

摘要: 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... 阅读全文
posted @ 2015-01-02 20:07 Ryan-Xing 阅读(112) 评论(0) 推荐(0) 编辑

Leetcode: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 solution using O(n) space is ... 阅读全文
posted @ 2015-01-02 20:00 Ryan-Xing 阅读(169) 评论(0) 推荐(0) 编辑

Leetcode: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 solution using O(n) space is ... 阅读全文
posted @ 2015-01-02 20:00 Ryan-Xing 阅读(141) 评论(0) 推荐(0) 编辑

Leetcode:Populating Next Right Pointers in Each Node II

摘要: Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution stil... 阅读全文
posted @ 2015-01-02 17:16 Ryan-Xing 阅读(123) 评论(0) 推荐(0) 编辑

Leetcode:Populating Next Right Pointers in Each Node

摘要: Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointe... 阅读全文
posted @ 2015-01-02 16:24 Ryan-Xing 阅读(199) 评论(0) 推荐(0) 编辑

Leetcode:Path Sum

摘要: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo... 阅读全文
posted @ 2015-01-02 15:40 Ryan-Xing 阅读(121) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 16 下一页