摘要:题目: Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed fr
阅读全文
摘要:题目: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given th
阅读全文
摘要:问题: Given a binary tree Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set toN
阅读全文
摘要:问题: Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. For example: Given the below binary tree, Retu
阅读全文
摘要:问题: Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number. An example is the root-to-leaf path1->2->3whic
阅读全文
摘要:问题: 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 the neares
阅读全文
摘要:问题: Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree{1,#,2,3}, return[3,2,1]. 递归方法: 非递归方法(利用栈)
阅读全文
摘要:问题: Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tree{1,#,2,3}, return[1,2,3]. 递归方法: 非递归方法(利用栈):
阅读全文