摘要:
Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the be... 阅读全文
摘要:
Word LadderGiven two words (startandend), and a dictionary, find the length of shortest transformation sequence fromstarttoend, such that:Only one let... 阅读全文
摘要:
Wildcard MatchingImplement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character.'*' Matches any sequence of characters... 阅读全文
摘要:
Regular Expression MatchingImplement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more o... 阅读全文
摘要:
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... 阅读全文
摘要:
SubsetsGiven a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For example,IfS=[1,2,3], a solution is:[ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], []]罗列所有的子集,要求每一个子集的元素有序,且... 阅读全文
摘要:
Populating Next Right Pointers in Each NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set toNULL.In... 阅读全文
摘要:
Sort ColorsGiven an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.Note:You are not suppose t 阅读全文