Ryan’s leetcode Blog
显示标签为“
binary tree
”的博文。
显示所有博文
显示标签为“
binary tree
”的博文。
显示所有博文
2015年10月26日星期一
Lowest Common Ancestor of a Binary Tree leetcode
›
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikiped...
2015年10月16日星期五
Binary Tree Right Side View leetcode
›
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bo...
2015年10月7日星期三
Binary Tree Upside Down leetcode
›
Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent node) or empty,...
2015年7月7日星期二
Binary Tree Postorder Traversal leetcode
›
Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3} , 1 \ ...
2015年6月11日星期四
Convert Sorted List to Binary Search Tree leetcode
›
因为链表和array不同, 不能直接访问中间元素. 中序遍历,按照递归中序遍历的顺序对链表结点一个个进行访问,而我们要构造的二分查找树正是按照链表的顺序来的。 思路就是先对左子树进行递归,然后将当前结点作为根,迭代到下一个链表结点,最后在递归求出右子树即可。 因为lis...
1 条评论:
Populating Next Right Pointers in Each Node leetcode
›
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Pop...
Populating Next Right Pointers in Each Node II leetcode
›
F For example, Given the following binary tree, 1 / \ 2 3 / \ \ 4 5 7 After calling ...
Construct Binary Tree from Inorder and Postorder Traversal leetcode
›
题解 : 这道题跟pre+in一样的方法做,只不过找左子树右子树的位置不同而已。 1 / \ 2 3 / \ / \ 4 5 6 7...
Construct Binary Tree from Preorder and Inorder Traversal leetcode
›
Given preorder and inorder traversal of a tree, construct the binary tree. Have you met this question in a real interview? Yes ...
2015年6月10日星期三
Flatten Binary Tree to Linked List leetcode
›
Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 ...
Symmetric Tree leetcode
›
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric...
Same Tree leetcode
›
Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurall...
Minimum Depth of Binary Tree leetcode
›
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to ...
2015年6月9日星期二
Sum Root to Leaf Numbers leetcode
›
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf pa...
Path Sum II leetcode
›
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below b...
Path Sum leetcode
›
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 g...
2015年4月23日星期四
Binary Tree Inorder Traversal leetcode
›
Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3} , 1 \ ...
Binary Tree Zigzag Level Order Traversal leetcode
›
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for th...
Binary Tree Level Order Traversal II leetcode
›
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from le...
2015年4月22日星期三
Binary Tree Level Order Traversal leetcode
›
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: ...
›
主页
查看网络版本