摘要:
题目: There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you ha 阅读全文
摘要:
DescriptionGiven a undirected graph, a node and a target, return the nearest node to given node which value of it is target, return NULL if you can't 阅读全文
摘要:
题目: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adj 阅读全文
摘要:
DescriptionConvert a binary search tree to doubly linked list with in-order traversal.ExampleGiven a binary search tree: 4 / \ 2 5 / \1 3return 1<->2< 阅读全文
摘要:
题目: Given a binary search tree and a node in it, find the in-order successor of that node in the BST. Note: If the given node has no in-order successo 阅读全文
摘要:
题目: Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node i 阅读全文
摘要:
题目: Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, return [3,2,1]. Note: Recursive 阅读全文
摘要:
题目 Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree [1,null,2,3], return [1,3,2]. Note: Recursive 阅读全文
摘要:
题目: Given a binary tree, return the preorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3]. Note: 阅读全文
摘要:
DescriptionIt's follow up problem for Binary Tree Longest Consecutive Sequence IIGiven a k-ary tree, find the length of the longest consecutive sequen 阅读全文