上一页 1 2 3 4 5 6 7 ··· 17 下一页
摘要: Say you have an array for which the ith element is the price of a given stock on day i. (Medium) Design an algorithm to find the maximum profit. You m 阅读全文
posted @ 2016-11-23 22:28 wangxiaobao1114 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the ith element is the price of a given stock on day i. (Easy) Design an algorithm to find the maximum profit. You may 阅读全文
posted @ 2016-11-23 22:27 wangxiaobao1114 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.(Medium) For example, give 阅读全文
posted @ 2016-11-22 21:10 wangxiaobao1114 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Given an index k, return the kth row of the Pascal's triangle. (Easy) For example, given k = 3,Return [1,3,3,1]. Note:Could you optimize your algorith 阅读全文
posted @ 2016-11-22 21:08 wangxiaobao1114 阅读(366) 评论(0) 推荐(0) 编辑
摘要: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, (Easy)Return 分析: 求解杨辉三角形,按照其定义以此求解即可,注意优化写法使其能够更简洁(比如对 阅读全文
posted @ 2016-11-22 21:06 wangxiaobao1114 阅读(239) 评论(0) 推荐(0) 编辑
摘要: Given a string S and a string T, count the number of distinct subsequences of T in S. (Hard) A subsequence of a string is a new string which is formed 阅读全文
posted @ 2016-11-17 22:36 wangxiaobao1114 阅读(393) 评论(1) 推荐(0) 编辑
摘要: Given a binary tree, flatten it to a linked list in-place. (Medium) For example,Given The flattened tree should look like: 分析: 将树的问题和链表插入问题结合。对于每个节点,寻 阅读全文
posted @ 2016-11-16 22:28 wangxiaobao1114 阅读(275) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.(Medium) For example:Given the below binary tree 阅读全文
posted @ 2016-11-16 22:24 wangxiaobao1114 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 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. ( 阅读全文
posted @ 2016-11-08 22:24 wangxiaobao1114 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 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 nearest l 阅读全文
posted @ 2016-11-08 22:22 wangxiaobao1114 阅读(165) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 17 下一页